styled.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import styled, { css } from 'styled-components';
  2. import { color } from '../../constants/style';
  3. const staticStyles = css`
  4. border-radius: 4px;
  5. display: inline-flex;
  6. flex-wrap: wrap;
  7. align-items: center;
  8. justify-content: flex-start;
  9. padding: 6px 16px;
  10. font-size: 14px;
  11. z-index: 1400;
  12. min-width: 288px;
  13. max-width: 330px;
  14. flex-grow: initial;
  15. width: auto;
  16. transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
  17. box-shadow: 0px 3px 5px -1px rgba(0,0,0,0.2), 0px 4px 12px 0px rgba(0,0,0,0.14), 0px 1px 8px 0px rgba(0,0,0,0.12);
  18. `;
  19. const theme: {[index: string]: any} = {
  20. default: css`
  21. color: ${color.black87};
  22. background-color: white;
  23. `,
  24. success: css`
  25. color: ${color.black87};
  26. background-color: ${color.success};
  27. `,
  28. error: css`
  29. color: ${color.black87};
  30. background-color: ${color.error};
  31. `,
  32. warning: css`
  33. color: ${color.black87};
  34. background-color: ${color.warning};
  35. `,
  36. };
  37. export const Wrapper = styled('div')<{appearance: string}>`
  38. ${staticStyles}
  39. ${props => theme[props.appearance]}
  40. `;
  41. export const Message = styled.div`
  42. padding: 8px 0;
  43. `;
  44. export const Action = styled.div`
  45. display: flex;
  46. align-items: center;
  47. margin-left: auto;
  48. padding-left: 16px;
  49. margin-right: -8px;
  50. `;