thirds.tsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import styled from '@emotion/styled';
  2. import NavTabs from 'sentry/components/navTabs';
  3. import space from 'sentry/styles/space';
  4. /**
  5. * Base container for 66/33 containers.
  6. */
  7. export const Body = styled('div')<{noRowGap?: boolean}>`
  8. padding: ${space(2)};
  9. margin: 0;
  10. background-color: ${p => p.theme.background};
  11. flex-grow: 1;
  12. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  13. padding: ${p =>
  14. !p.noRowGap ? `${space(3)} ${space(4)}` : `${space(2)} ${space(4)}`};
  15. }
  16. @media (min-width: ${p => p.theme.breakpoints.large}) {
  17. display: grid;
  18. grid-template-columns: minmax(100px, auto) 325px;
  19. align-content: start;
  20. gap: ${p => (!p.noRowGap ? `${space(3)}` : `0 ${space(3)}`)};
  21. }
  22. `;
  23. /**
  24. * Use HeaderContent to create horizontal regions in the header
  25. * that contain a heading/breadcrumbs and a button group.
  26. */
  27. export const HeaderContent = styled('div')`
  28. display: flex;
  29. flex-direction: column;
  30. justify-content: normal;
  31. margin-bottom: ${space(2)};
  32. overflow: hidden;
  33. max-width: 100%;
  34. @media (max-width: ${p => p.theme.breakpoints.medium}) {
  35. margin-bottom: ${space(1)};
  36. }
  37. `;
  38. /**
  39. * Container for action buttons and secondary information that
  40. * flows on the top right of the header.
  41. */
  42. export const HeaderActions = styled('div')`
  43. display: flex;
  44. flex-direction: column;
  45. justify-content: normal;
  46. min-width: max-content;
  47. margin-top: ${space(0.25)};
  48. @media (max-width: ${p => p.theme.breakpoints.medium}) {
  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. ${p => p.theme.overflowEllipsis};
  65. @media (max-width: ${p => p.theme.breakpoints.medium}) {
  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('header')<{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.medium}) {
  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. display: flex;
  101. align-items: center;
  102. height: 1.25rem;
  103. padding: ${space(1)} 0;
  104. margin-bottom: 4px;
  105. box-sizing: content-box;
  106. }
  107. & > li.active > a {
  108. margin-bottom: 0;
  109. }
  110. `;
  111. /**
  112. * Containers for two column 66/33 layout.
  113. */
  114. export const Main = styled('section')<{fullWidth?: boolean}>`
  115. grid-column: ${p => (p.fullWidth ? '1/3' : '1/2')};
  116. max-width: 100%;
  117. `;
  118. export const Side = styled('aside')`
  119. grid-column: 2/3;
  120. `;