thirds.tsx 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. @media (max-width: ${p => p.theme.breakpoints.medium}) {
  48. width: max-content;
  49. margin-bottom: ${space(2)};
  50. }
  51. `;
  52. /**
  53. * Heading container that includes margins.
  54. */
  55. export const Title = styled('h1')`
  56. ${p => p.theme.text.pageTitle};
  57. color: ${p => p.theme.headingColor};
  58. margin-top: ${space(2)};
  59. /* TODO(bootstrap) Remove important when bootstrap headings are removed */
  60. margin-bottom: 0 !important;
  61. min-height: 30px;
  62. align-self: center;
  63. ${p => p.theme.overflowEllipsis};
  64. @media (max-width: ${p => p.theme.breakpoints.medium}) {
  65. margin-top: ${space(1)};
  66. }
  67. `;
  68. /**
  69. * Header container for header content and header actions.
  70. *
  71. * Uses a horizontal layout in wide viewports to put space between
  72. * the headings and the actions container. In narrow viewports these elements
  73. * are stacked vertically.
  74. *
  75. * Use `noActionWrap` to disable wrapping if there are minimal actions.
  76. */
  77. export const Header = styled('header')<{noActionWrap?: boolean}>`
  78. display: grid;
  79. grid-template-columns: ${p =>
  80. !p.noActionWrap ? 'minmax(0, 1fr)' : 'minmax(0, 1fr) auto'};
  81. padding: ${space(2)} ${space(2)} 0 ${space(2)};
  82. background-color: transparent;
  83. border-bottom: 1px solid ${p => p.theme.border};
  84. @media (min-width: ${p => p.theme.breakpoints.medium}) {
  85. padding: ${space(2)} ${space(4)} 0 ${space(4)};
  86. grid-template-columns: minmax(0, 1fr) auto;
  87. }
  88. `;
  89. /**
  90. * Styled Nav Tabs for use inside a Layout.Header component
  91. */
  92. export const HeaderNavTabs = styled(NavTabs)`
  93. margin: 0;
  94. border-bottom: 0 !important;
  95. & > li {
  96. margin-right: ${space(3)};
  97. }
  98. & > li > a {
  99. display: flex;
  100. align-items: center;
  101. height: 1.25rem;
  102. padding: ${space(1)} 0;
  103. margin-bottom: 4px;
  104. box-sizing: content-box;
  105. }
  106. & > li.active > a {
  107. margin-bottom: 0;
  108. }
  109. `;
  110. /**
  111. * Containers for two column 66/33 layout.
  112. */
  113. export const Main = styled('section')<{fullWidth?: boolean}>`
  114. grid-column: ${p => (p.fullWidth ? '1/3' : '1/2')};
  115. max-width: 100%;
  116. `;
  117. export const Side = styled('aside')`
  118. grid-column: 2/3;
  119. `;