Skip to content

Commit

Permalink
Issue #10: Improved output formatting
Browse files Browse the repository at this point in the history
Styled copy button
Fixed typo and joined guids for copying by new lines
  • Loading branch information
veronikaslc committed Oct 20, 2020
1 parent e1d554a commit 05ceab4
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions guids-generator.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,16 @@
table: {
padding: "0",
},
copyButton: {
float: "right",
},
copyButtonSuccess: {
float: "right",
backgroundColor: theme.palette.success.main,
"&:hover,&:focus,&:visited,&": {
backgroundColor: theme.palette.success.dark,
}
},
}));

const StyledTableCell = withStyles((theme) => ({
Expand Down Expand Up @@ -405,6 +415,13 @@
})
}

let onCopyButtonClick = () => {
setCopied(true);
setTimeout(function() {
setCopied(false);
}, 3000);
}

return (
<div className={classes.main}>
<Typography variant="h3">GUID generator</Typography>
Expand Down Expand Up @@ -493,13 +510,15 @@
<StyledTableCell>Health card #</StyledTableCell>
<StyledTableCell>Province</StyledTableCell>
<StyledTableCell>Date of birth</StyledTableCell>
<StyledTableCell>GUID
<CopyToClipboard text={validatedData.map(item => item.isError ? '' : bhashes[item.index].value).join('\t')} onCopy={() => setCopied(true)}>
<IconButton title="Copy GGUIDs to clipboard" >
<Icon>file_copy</Icon>
</IconButton>
<StyledTableCell><span>GUID</span>
<CopyToClipboard text={validatedData.map(item => item.isError ? '' : bhashes[item.index].value).join('\n\r')} onCopy={() => onCopyButtonClick()}>
<Button variant="contained"
color="primary"
className={copied ? classes.copyButtonSuccess : classes.copyButton}
startIcon=<Icon>{copied ? "check" : "file_copy"}</Icon>>
{copied ? "Copied" : "Copy GUIDs"}
</Button>
</CopyToClipboard>
{ copied ? <span style={{color: 'green'}}>Copied</span> : null }
</StyledTableCell>
</TableRow>
</TableHead>
Expand Down

0 comments on commit 05ceab4

Please sign in to comment.