Spaces:
Running
Running
File size: 1,339 Bytes
fba4209 b225f7d fba4209 b225f7d fba4209 b225f7d fba4209 b225f7d fba4209 | 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 | import React from 'react';
const Button = ({ text, onClick, type = 'primary', disabled = false, className = '' }) => {
const buttonTypes = {
primary: 'border-hmi-accent bg-hmi-accent text-hmi-bg [@media(hover:hover)]:hover:brightness-110',
secondary: 'border-hmi-line bg-hmi-raised text-hmi-text [@media(hover:hover)]:hover:border-hmi-muted',
success: 'border-hmi-ok bg-hmi-ok text-hmi-bg',
danger: 'border-red-600 bg-red-600 text-white [@media(hover:hover)]:hover:bg-red-500',
outline: 'border-hmi-line bg-transparent text-hmi-text [@media(hover:hover)]:hover:border-hmi-muted',
link: 'border-transparent bg-transparent text-hmi-accent hover:underline',
};
return (
<button
type="button"
className={`
inline-flex min-h-[44px] items-center justify-center gap-2 border-2 px-5
text-sm font-semibold uppercase tracking-[0.08em]
select-none touch-manipulation transition active:translate-y-px
focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-hmi-accent
disabled:cursor-not-allowed disabled:opacity-50 disabled:active:translate-y-0
${buttonTypes[type]}
${className}
`}
onClick={onClick}
disabled={disabled}
>
{text}
</button>
);
};
export default Button;
|