button.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import styled, { CSSObject } from 'styled-components';
  2. import { colorToString } from '../utils/colorify';
  3. const TalkyButton = styled.button`
  4. border-radius: 5px;
  5. transition: background 200ms linear;
  6. font-size: 14px;
  7. min-height: 30px;
  8. min-width: 30px;
  9. border: none;
  10. color: ${({ theme }) => colorToString(theme.buttonSecondaryText)};
  11. background-color: ${({ theme }) =>
  12. colorToString(theme.buttonSecondaryBackground)};
  13. :hover {
  14. background-color: ${({ theme }) =>
  15. colorToString(theme.buttonSecondaryBackgroundHover)};
  16. }
  17. :active {
  18. background-color: ${({ theme }) =>
  19. colorToString(theme.buttonSecondaryBackgroundActive)};
  20. }
  21. :focus {
  22. outline: 0;
  23. }
  24. svg {
  25. fill: ${({ theme }) => colorToString(theme.buttonSecondaryText)};
  26. vertical-align: middle;
  27. font-size: 20px;
  28. :not(:only-child) {
  29. margin-left: 7px;
  30. }
  31. }
  32. & a {
  33. color: ${({ theme }) => colorToString(theme.buttonSecondaryText)};
  34. }
  35. & span {
  36. padding-left: 3px;
  37. padding-right: 3px;
  38. margin-right: 5px;
  39. }
  40. `;
  41. const buttonBase: CSSObject = {
  42. borderRadius: '5px',
  43. transition: 'background 200ms linear',
  44. fontSize: '14px',
  45. minHeight: '30px',
  46. minWidth: '30px',
  47. border: 'none',
  48. color: '#505658',
  49. backgroundColor: '#e9ecec',
  50. '&:hover': {
  51. backgroundColor: '#cdd3d5'
  52. },
  53. '&:focus': {
  54. outline: 0
  55. },
  56. '& svg': {
  57. fill: '#505658',
  58. verticalAlign: 'middle',
  59. fontSize: '20px',
  60. '&:not(:only-child)': {
  61. marginLeft: '7px'
  62. }
  63. },
  64. '& a': {
  65. color: '#505658'
  66. },
  67. '& span': {
  68. paddingLeft: '3px',
  69. paddingRight: '3px',
  70. marginRight: '5px'
  71. }
  72. };
  73. export { buttonBase, TalkyButton };