thirds.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. import styled from '@emotion/styled';
  2. import NavTabs from 'app/components/navTabs';
  3. import overflowEllipsis from 'app/styles/overflowEllipsis';
  4. import space from 'app/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. grid-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. font-size: ${p => p.theme.headerFontSize};
  58. font-weight: normal;
  59. line-height: 1.2;
  60. color: ${p => p.theme.textColor};
  61. margin-top: ${space(3)};
  62. /* TODO(bootstrap) Remove important when bootstrap headings are removed */
  63. margin-bottom: 0 !important;
  64. min-height: 30px;
  65. align-self: center;
  66. ${overflowEllipsis};
  67. @media (max-width: ${p => p.theme.breakpoints[1]}) {
  68. margin-top: ${space(1)};
  69. }
  70. `;
  71. /**
  72. * Header container for header content and header actions.
  73. *
  74. * Uses a horizontal layout in wide viewports to put space between
  75. * the headings and the actions container. In narrow viewports these elements
  76. * are stacked vertically.
  77. */
  78. export const Header = styled('div')`
  79. display: grid;
  80. grid-template-columns: minmax(0, 1fr);
  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[1]}) {
  85. grid-template-columns: minmax(0, 1fr) auto;
  86. padding: ${space(2)} ${space(4)} 0 ${space(4)};
  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. padding: ${space(1)} 0;
  100. margin-bottom: 4px;
  101. }
  102. & > li.active > a {
  103. margin-bottom: 0;
  104. }
  105. `;
  106. /**
  107. * Containers for two column 66/33 layout.
  108. */
  109. export const Main = styled('section')<{fullWidth?: boolean}>`
  110. grid-column: ${p => (p.fullWidth ? '1/3' : '1/2')};
  111. max-width: 100%;
  112. `;
  113. export const Side = styled('aside')`
  114. grid-column: 2/3;
  115. `;