mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
36 lines
522 B
TypeScript
36 lines
522 B
TypeScript
import React, { FC } from 'react';
|
|
|
|
export type Type = 'default' | 'action';
|
|
|
|
interface Props {
|
|
/**
|
|
* Click event `handler`
|
|
*
|
|
* Example function:
|
|
*
|
|
* ```
|
|
* () => {
|
|
* doThis();
|
|
* }
|
|
* ```
|
|
*
|
|
* @default null
|
|
*/
|
|
onClick?: () => void;
|
|
|
|
/**
|
|
* Button type yo
|
|
*/
|
|
type?: Type;
|
|
}
|
|
|
|
const Button: FC<Props> = ({ children, type = 'default', onClick }) => {
|
|
return (
|
|
<button type="button" onClick={onClick}>
|
|
{type}: {children}
|
|
</button>
|
|
);
|
|
};
|
|
|
|
export default Button;
|