styles.tsx 2.4 KB

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