thirds.tsx 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import styled from '@emotion/styled';
  2. import NavTabs from 'sentry/components/navTabs';
  3. import overflowEllipsis from 'sentry/styles/overflowEllipsis';
  4. import space from 'sentry/styles/space';
  5. /**
  6. * Base container for 66/33 containers.
  7. */
  8. export const Body = styled('div')`
  9. padding: ${space(2)};
  10. margin: 0;
  11. background-color: ${p => p.theme.background};
  12. flex-grow: 1;
  13. @media (min-width: ${p => p.theme.breakpoints[1]}) {
  14. display: grid;
  15. grid-template-columns: 66% auto;
  16. align-content: start;
  17. gap: ${space(3)};
  18. padding: ${space(3)} ${space(4)};
  19. }
  20. @media (min-width: ${p => p.theme.breakpoints[2]}) {
  21. grid-template-columns: minmax(100px, auto) 325px;
  22. }
  23. `;
  24. /**
  25. * Use HeaderContent to create horizontal regions in the header
  26. * that contain a heading/breadcrumbs and a button group.
  27. */
  28. export const HeaderContent = styled('div')`
  29. display: flex;
  30. flex-direction: column;
  31. justify-content: normal;
  32. margin-bottom: ${space(2)};
  33. overflow: hidden;
  34. max-width: 100%;
  35. @media (max-width: ${p => p.theme.breakpoints[1]}) {
  36. margin-bottom: ${space(1)};
  37. }
  38. `;
  39. /**
  40. * Container for action buttons and secondary information that
  41. * flows on the top right of the header.
  42. */
  43. export const HeaderActions = styled('div')`
  44. display: flex;
  45. flex-direction: column;
  46. justify-content: normal;
  47. min-width: max-content;
  48. @media (max-width: ${p => p.theme.breakpoints[1]}) {
  49. width: max-content;
  50. margin-bottom: ${space(2)};
  51. }
  52. `;
  53. /**
  54. * Heading container that includes margins.
  55. */
  56. export const Title = styled('h1')`
  57. ${p => p.theme.text.pageTitle};
  58. color: ${p => p.theme.headingColor};
  59. margin-top: ${space(2)};
  60. /* TODO(bootstrap) Remove important when bootstrap headings are removed */
  61. margin-bottom: 0 !important;
  62. min-height: 30px;
  63. align-self: center;
  64. ${overflowEllipsis};
  65. @media (max-width: ${p => p.theme.breakpoints[1]}) {
  66. margin-top: ${space(1)};
  67. }
  68. `;
  69. /**
  70. * Header container for header content and header actions.
  71. *
  72. * Uses a horizontal layout in wide viewports to put space between
  73. * the headings and the actions container. In narrow viewports these elements
  74. * are stacked vertically.
  75. *
  76. * Use `noActionWrap` to disable wrapping if there are minimal actions.
  77. */
  78. export const Header = styled('div')<{noActionWrap?: boolean}>`
  79. display: grid;
  80. grid-template-columns: ${p =>
  81. !p.noActionWrap ? 'minmax(0, 1fr)' : 'minmax(0, 1fr) auto'};
  82. padding: ${space(2)} ${space(2)} 0 ${space(2)};
  83. background-color: transparent;
  84. border-bottom: 1px solid ${p => p.theme.border};
  85. @media (min-width: ${p => p.theme.breakpoints[1]}) {
  86. padding: ${space(2)} ${space(4)} 0 ${space(4)};
  87. grid-template-columns: minmax(0, 1fr) auto;
  88. }
  89. `;
  90. /**
  91. * Styled Nav Tabs for use inside a Layout.Header component
  92. */
  93. export const HeaderNavTabs = styled(NavTabs)`
  94. margin: 0;
  95. border-bottom: 0 !important;
  96. & > li {
  97. margin-right: ${space(3)};
  98. }
  99. & > li > a {
  100. padding: ${space(1)} 0;
  101. margin-bottom: 4px;
  102. }
  103. & > li.active > a {
  104. margin-bottom: 0;
  105. }
  106. `;
  107. /**
  108. * Containers for two column 66/33 layout.
  109. */
  110. export const Main = styled('section')<{fullWidth?: boolean}>`
  111. grid-column: ${p => (p.fullWidth ? '1/3' : '1/2')};
  112. max-width: 100%;
  113. `;
  114. export const Side = styled('aside')`
  115. grid-column: 2/3;
  116. `;