Skip to content

Commit

Permalink
✨ copy result added
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdhika31 committed Oct 20, 2020
1 parent a4f963e commit 596d01c
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 1 deletion.
83 changes: 83 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"bootstrap": "^4.5.3",
"copy-to-clipboard": "^3.3.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-scripts": "3.4.3",
"reactstrap": "^8.6.0"
"reactstrap": "^8.6.0",
"save": "^2.4.0"
},
"scripts": {
"start": "react-scripts start",
Expand Down
15 changes: 15 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Button from '@material-ui/core/Button';
import TextareaAutosize from '@material-ui/core/TextareaAutosize';
import Alert from '@material-ui/lab/Alert';
import DeleteIcon from '@material-ui/icons/Delete';
import copy from "copy-to-clipboard";

const useStyles = makeStyles((theme) => ({
formControl: {
Expand Down Expand Up @@ -412,7 +413,21 @@ export default function App() {
<FormControl fullWidth variant="outlined" className={classes.formControl}>
Result :
<TextareaAutosize readonly className="form-control" aria-label="json" rowsMin={3} placeholder="JSON" value={curlCommandText}/>

<Button
variant="contained"
color="primary"
className={"mt-2 "+classes.button}
onClick={() => {
alert("Copied! => "+curlCommandText)
copy(curlCommandText)
}}
>
Copy to clipboard
</Button>
</FormControl>


</CardContent>
</Card>
</div>
Expand Down

0 comments on commit 596d01c

Please sign in to comment.