Layout scaffolding for Web apps.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

126 lines
2.2 KiB

  1. import { css } from '@tesseract-design/goofy-goober';
  2. import {LayoutArgs, Span} from '../common';
  3. export const Base = () => css.cx(
  4. css`
  5. position: fixed;
  6. top: 0;
  7. left: 0;
  8. width: 100%;
  9. height: var(--height-topbar, 4rem);
  10. z-index: 3;
  11. & > * {
  12. display: block;
  13. width: 100%;
  14. height: 100%;
  15. background-color: var(--color-background, white);
  16. }
  17. & ~ * {
  18. padding-top: var(--height-topbar, 4rem);
  19. }
  20. ~ main ~ * {
  21. padding-top: 0;
  22. }
  23. `,
  24. css.media('(min-width: 1080px)')(
  25. css`
  26. ~ main ~ * {
  27. padding-top: var(--height-topbar, 4rem);
  28. }
  29. `
  30. )
  31. );
  32. export const Container = ({
  33. span,
  34. }: LayoutArgs) => css.cx(
  35. css`
  36. padding: 0 1rem;
  37. box-sizing: border-box;
  38. margin: 0 auto;
  39. width: 100%;
  40. height: 100%;
  41. display: flex;
  42. align-items: center;
  43. position: relative;
  44. z-index: 1;
  45. `,
  46. css.if(span === Span.NARROW)(
  47. css`
  48. max-width: var(--base-width);
  49. `
  50. ),
  51. css.if(span === Span.NORMAL)(
  52. css`
  53. max-width: calc(var(--base-width) * 2);
  54. `
  55. ),
  56. css.if(span === Span.WIDE)(
  57. css.media('(min-width: 1080px)')(
  58. css`
  59. max-width: calc(var(--base-width) * 3);
  60. `
  61. )
  62. ),
  63. );
  64. export const CenterContainer = () => css.cx(
  65. css`
  66. flex: auto;
  67. padding: 0 1rem;
  68. box-sizing: border-box;
  69. `,
  70. css.nest(':first-child')(
  71. css`
  72. padding-left: 0;
  73. `
  74. )
  75. )
  76. export const ActionContainer = () => css.cx(
  77. css`
  78. display: flex;
  79. align-items: center;
  80. justify-content: flex-end;
  81. height: 100%;
  82. white-space: nowrap;
  83. `,
  84. css.media('(min-width: 720px)')(
  85. css`
  86. min-width: 8rem;
  87. `
  88. )
  89. );
  90. export const LinkContainer = () => css.cx(
  91. css`
  92. width: var(--height-topbar, 4rem);
  93. height: 100%;
  94. & > * {
  95. width: 100%;
  96. height: 100%;
  97. display: inline-grid;
  98. place-content: center;
  99. }
  100. `
  101. );
  102. export const MenuLinkContainer = () => css.cx(
  103. css`
  104. width: var(--height-topbar, 4rem);
  105. height: 100%;
  106. & > * {
  107. width: 100%;
  108. height: 100%;
  109. display: inline-grid;
  110. place-content: center;
  111. }
  112. `,
  113. css.media('(min-width: 1080px)')(
  114. css`
  115. position: absolute;
  116. left: -999999px;
  117. `
  118. )
  119. );