Skip to content

Commit

Permalink
Add ariaLabel to <Button /> and <Checkbox />, edit index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
daxter-army committed Sep 15, 2023
1 parent eca4f29 commit 9fc1e26
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/react-cpp-wasm-app/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WASM Notes App | React + CPP</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;900&display=swap" rel="stylesheet">
<title>WASM Notes App | React + CPP</title>
<script type="module" crossorigin src="/react-cpp-wasm-app/assets/index-0734ae79.js"></script>
<link rel="stylesheet" href="/react-cpp-wasm-app/assets/index-bfb5dfe7.css">
</head>
<body>
<div id="root"></div>
<!-- WASM Entrypoint, Naive Approach -->
<script type="text/javascript" src="/react-cpp-wasm-app/wasm/wasm.js"></script>
<!-- Application Entrypoint -->
<script type="module" crossorigin src="/react-cpp-wasm-app/assets/index-1f7a25a6.js"></script>
</body>
</html>
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<div id="root"></div>
<!-- WASM Entrypoint, Naive Approach -->
<script type="text/javascript" src="/wasm/wasm.js"></script>
<!-- Application Entrypoint -->
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
1 change: 1 addition & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function App() {
<div className={styles.headingWpr}>
<Input value={value} setValue={setValue} placeholder={ENUMS.SEARCH_PLACEHOLDER} />
<Button
ariaLabel="Add Todo"
variant={ENUMS.ADD_NOTE}
onClick={addTodoButtonHandler}
isDisabled={value.length === 0}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Button/Button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ENUMS } from '@/enums';

import styles from './Button.module.css';

const Button = ({ variant, children, onClick, isDisabled = false }) => {
const Button = ({ variant, children, onClick, isDisabled = false, ariaLabel = "button" }) => {
const buttonStyles = {
[ENUMS.ADD_NOTE]: styles.addBtn,
[ENUMS.DISABLED]: styles.disabledBtn,
Expand All @@ -11,6 +11,7 @@ const Button = ({ variant, children, onClick, isDisabled = false }) => {

return (
<button
ariaLabel={ariaLabel}
disabled={isDisabled}
className={`${styles.buttonWpr} ${isDisabled ? buttonStyles.DISABLED : buttonStyles[variant]}`}
onClick={onClick}
Expand Down
3 changes: 2 additions & 1 deletion src/components/Checkbox/Checkbox.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import styles from './Checkbox.module.css';

const Checkbox = ({ isChecked, onChange }) => {
const Checkbox = ({ isChecked, onChange, ariaLabel = "checkbox" }) => {
return (
<input
ariaLabel={ariaLabel}
type='checkbox'
checked={isChecked}
onChange={onChange}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Note/Note.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const Note = ({note, idx}) => {
return (
<div onClick={() => onNoteClick(idx)} className={`${styles.noteWpr} ${note.status ? styles.isCompleted : ''}`}>
<div className={styles.noteLabel}>
<Checkbox isChecked={note.status} onChange={() => onNoteClick(idx)} />
<Checkbox ariaLabel={'Toggle done/undone Todo'} isChecked={note.status} onChange={() => onNoteClick(idx)} />
<span className={note.status ? styles.isDone : ''}>{note?.description}</span>
</div>
<Button variant={ENUMS.DELETE_NOTE} onClick={(e) => deleteButtonHandler(e, idx)}>
<Button ariaLabel="Remove Todo" variant={ENUMS.DELETE_NOTE} onClick={(e) => deleteButtonHandler(e, idx)}>
<PiTrashLight size={25} />
</Button>
</div>
Expand Down

0 comments on commit 9fc1e26

Please sign in to comment.