Files
freeCodeCamp/tools/ui-components/src/button.tsx
Ahmad Abdolsaheb f56a5617ac feat: add tailwind theme support (#43616)
* feat: add tailwind theme support

* feat: simplify config
2021-10-11 10:38:44 +03:00

33 lines
614 B
TypeScript

import React from 'react';
import { ButtonProps } from './button.types';
import './button.css';
/**
* Primary UI component for user interaction
*/
export const Button: React.FC<ButtonProps> = ({
primary,
size = 'medium',
label,
...props
}: ButtonProps) => {
const mode = primary
? 'storybook-button--primary'
: 'storybook-button--secondary';
return (
<button
className={[
'storybook-button',
`storybook-button--${size}`,
mode,
'button-default-style'
].join(' ')}
type='button'
{...props}
>
{label}
</button>
);
};