Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 1x 2x 2x 2x 2x 2x 2x 2x 1x | import styles from './ButtonClick.module.css';
/**
* Props for the ButtonClick component.
*
* @property {string} text - The label text to display inside the button.
* @property {() => void} onClick - Callback function to handle the button click event.
*/
interface ButtonClickProps {
text: string; // Text to display inside the button
onClick: () => void;
}
/**
* A reusable styled button component that executes a callback function when clicked.
*
* @component
* @param {ButtonClickProps} props - The props for the button.
* @returns {JSX.Element} A styled button with a click handler.
* @example
* ```tsx
* const handleStart = () => {
* console.log("Game started");
* };
*
* <ButtonClick text="Start Game" onClick={handleStart} />
* ```
*/
function ButtonClick({ text, onClick }: ButtonClickProps) {
return (
<button className={styles.button} onClick={onClick}>
<span>{text}</span>
<span className={styles.arrow} aria-hidden="true">→</span>
</button>
);
}
export default ButtonClick; |