Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. import React from "react";
  2.  
  3. import CSSModules from "react-css-modules";
  4.  
  5. import classNames from "classnames";
  6.  
  7. import styles from "./Button.module.sass";
  8.  
  9. export type ButtonTheme =
  10. | "primary"
  11. | "primary-white";
  12.  
  13. export interface ButtonProps {
  14. onClick: () => void;
  15. id?: string;
  16. disabled?: boolean;
  17. children?: React.ReactNode;
  18. theme?: ButtonTheme;
  19. }
  20.  
  21. export const Button: React.SFC<ButtonProps> =
  22. CSSModules(styles)(
  23. ({
  24. theme = "primary",
  25. children,
  26. ...restProps
  27. }: ButtonProps) =>
  28. <button
  29. { ...restProps }
  30. styleName={
  31. classNames(
  32. "button",
  33. theme
  34. )
  35. }
  36. >
  37. { children }
  38. </button>
  39. );
  40.  
  41. @import "~@assets/stylesheets/sass-variables"
  42.  
  43. $button-disabled-background-color: rgba($black, .1)
  44.  
  45. .button
  46. display: inline-block
  47. height: var(--button-height)
  48. padding: 0 15px
  49. font-family: "Open Sans", sans-serif
  50. font-size: 14px
  51. font-weight: 600
  52. white-space: nowrap
  53. cursor: pointer
  54. border: 0
  55. border-radius: 6px
  56. outline: none
  57. box-sizing: border-box
  58.  
  59. &:not([disabled]):hover
  60. background-color: var(--color-action)
  61.  
  62. &:disabled
  63. color: $button-disabled-color
  64. cursor: auto
  65. background-color: $button-disabled-background-color
  66. .primary
  67. color: var(--color-white)
  68. background-color: var(--color-primary)
  69. .primary-white
  70. color: var(--color-primary)
  71. background-color: var(--color-white)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement