mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-01-02 21:03:43 -05:00
33 lines
614 B
TypeScript
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>
|
|
);
|
|
};
|