Download todoist/src/components/Checkbox.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 737 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/todoist/src/components/Checkbox.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/todoist/src/components/Checkbox.js
-
curl -L -o Checkbox.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/todoist/src/components/Checkbox.js
737 Bytes
| import React from 'react'; | |
| import PropTypes from 'prop-types'; | |
| import { firebase } from '../firebase'; | |
| export const Checkbox = ({ id, taskDesc }) => { | |
| const archiveTask = () => { | |
| firebase.firestore().collection('tasks').doc(id).update({ | |
| archived: true, | |
| }); | |
| }; | |
| return ( | |
| <div | |
| className="checkbox-holder" | |
| data-testid="checkbox-action" | |
| onClick={() => archiveTask()} | |
| onKeyDown={(e) => { | |
| if (e.key === 'Enter') archiveTask(); | |
| }} | |
| aria-label={`Mark ${taskDesc} as done?`} | |
| role="button" | |
| tabIndex={0} | |
| > | |
| <span className="checkbox" /> | |
| </div> | |
| ); | |
| }; | |
| Checkbox.propTypes = { | |
| id: PropTypes.string.isRequired, | |
| taskDesc: PropTypes.string.isRequired, | |
| }; | |