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 | 6x 6x 2x 1x 6x | import { ReactNode, CSSProperties } from "react";
interface ButtonProps {
style?: CSSProperties;
onClick?: () => void;
disabled?: boolean;
children: ReactNode;
}
export const Button = (props: ButtonProps) => {
const handleOnClick = () => {
if (!props.disabled && props.onClick) {
props.onClick();
}
};
return (
<button
onClick={handleOnClick}
style={props.style}
disabled={props.disabled}
type="submit"
className="rounded-md px-4 py-2 mt-4 bg-blue-500 text-white w-fit"
>
{props.children}
</button>
);
};
|