index.tsx 851 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React from 'react';
  2. import {
  3. NormalButton,
  4. DisableButton,
  5. } from './styled';
  6. export type Props = {
  7. appearance?: 'default' | 'primary' | 'primary-hollow' | 'default-hollow' | 'link' | 'danger-link';
  8. id?: string;
  9. isDisabled?: boolean;
  10. onClick?: () => void;
  11. onBlur?: () => void;
  12. shouldFitContainer?: boolean;
  13. align?: 'left' | 'center' | 'right';
  14. children: React.ReactNode;
  15. style?: {};
  16. };
  17. const Button: React.FunctionComponent<Props> = ({
  18. children,
  19. isDisabled,
  20. ...rest
  21. }: Props): React.ReactElement => (
  22. isDisabled ? (
  23. <DisableButton>
  24. {children}
  25. </DisableButton>
  26. ) : (
  27. <NormalButton
  28. {...rest}
  29. >
  30. {children}
  31. </NormalButton>
  32. )
  33. );
  34. Button.defaultProps = {
  35. appearance: 'default',
  36. align: 'center',
  37. shouldFitContainer: false,
  38. isDisabled: false,
  39. };
  40. export default Button;