styles.tsx 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import styled from '@emotion/styled';
  2. import space from 'app/styles/space';
  3. import {Theme} from 'app/utils/theme';
  4. export const DataSection = styled('div')`
  5. padding: ${space(2)} 0;
  6. border-top: 1px solid ${p => p.theme.innerBorder};
  7. @media (min-width: ${p => p.theme.breakpoints[0]}) {
  8. padding: ${space(3)} ${space(4)} 0 40px;
  9. }
  10. `;
  11. type BannerProps = {
  12. priority: 'default' | 'danger' | 'success';
  13. };
  14. function getColors({priority, theme}: BannerProps & {theme: Theme}) {
  15. const COLORS = {
  16. default: {
  17. background: theme.backgroundSecondary,
  18. border: theme.border,
  19. },
  20. danger: {
  21. background: theme.alert.error.backgroundLight,
  22. border: theme.alert.error.border,
  23. },
  24. success: {
  25. background: theme.alert.success.backgroundLight,
  26. border: theme.alert.success.border,
  27. },
  28. } as const;
  29. return COLORS[priority];
  30. }
  31. export const BannerContainer = styled('div')<BannerProps>`
  32. font-size: ${p => p.theme.fontSizeMedium};
  33. background: ${p => getColors(p).background};
  34. border-top: 1px solid ${p => getColors(p).border};
  35. border-bottom: 1px solid ${p => getColors(p).border};
  36. /* Muted box & processing errors are in different parts of the DOM */
  37. &
  38. + ${/* sc-selector */ DataSection}:first-child,
  39. &
  40. + div
  41. > ${/* sc-selector */ DataSection}:first-child {
  42. border-top: 0;
  43. }
  44. `;
  45. export const BannerSummary = styled('p')`
  46. display: flex;
  47. align-items: flex-start;
  48. padding: ${space(2)} ${space(4)} ${space(2)} 40px;
  49. margin-bottom: 0;
  50. /* Get icons in top right of content box */
  51. & > .icon,
  52. & > svg {
  53. flex-shrink: 0;
  54. flex-grow: 0;
  55. margin-right: ${space(1)};
  56. margin-top: 2px;
  57. }
  58. & > span {
  59. flex-grow: 1;
  60. }
  61. & > a {
  62. align-self: flex-end;
  63. }
  64. `;
  65. export const CauseHeader = styled('div')`
  66. display: flex;
  67. justify-content: space-between;
  68. align-items: center;
  69. margin-bottom: ${space(3)};
  70. & button,
  71. & h3 {
  72. color: ${p => p.theme.gray300};
  73. font-size: 14px;
  74. font-weight: 600;
  75. line-height: 1.2;
  76. text-transform: uppercase;
  77. }
  78. & h3 {
  79. margin-bottom: 0;
  80. }
  81. & button {
  82. background: none;
  83. border: 0;
  84. outline: none;
  85. padding: 0;
  86. }
  87. `;