Skip to content
Snippets Groups Projects
Verified Commit 68ed4654 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: focusable buttons

parent c22cf696
No related branches found
No related tags found
No related merge requests found
Pipeline #1467 passed
......@@ -43,13 +43,28 @@ export const Button: FC<ButtonProps> = ({
onFile && onFile(file);
event.target.value = "";
};
const onKeyPress = (event: React.KeyboardEvent) => {
if (event.key == "Enter") {
onClick && onClick();
}
};
const renderSimple = () => (
<span className={classes()} onClick={onClick}>
<span
className={classes()}
onClick={onClick}
onKeyPress={onKeyPress}
tabIndex={0}
>
{text}
</span>
);
const renderComplex = () => (
<span className={classes()} onClick={onClick}>
<span
className={classes()}
onClick={onClick}
onKeyPress={onKeyPress}
tabIndex={0}
>
{image && <img src={image} alt={imageAlt || text || "button"} />}
{file && (
<input type="file" accept={accept} onChange={onFileChange} />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment