styles.tsx 2.3 KB

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