fbredius/storybook

View on GitHub
examples/official-storybook/components/TsButton.tsx

Summary

Maintainability
A
2 hrs
Test Coverage
import React, { FunctionComponent } from 'react';

export type Type = 'default' | 'action';

interface Props {
  /**
   * Click event handler
   * @default null
   */
  onClick?: () => void;

  /**
   * Button type yo
   */
  type?: Type;
}

const Button: FunctionComponent<Props> = ({ children, type = 'default', onClick }) => {
  return (
    <button type="button" onClick={onClick}>
      {type}: {children}
    </button>
  );
};

export default Button;