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.

LeftSidebarWithMenu.ts 6.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. import { css } from '@tesseract-design/css-utils';
  2. import {LayoutArgs} from '../common';
  3. export const ContentBase = () => css.cx(
  4. css`
  5. box-sizing: border-box;
  6. padding-bottom: var(--size-menu, 4rem);
  7. `,
  8. css.media('(min-width: 1080px)')(
  9. css`
  10. padding-left: calc(50% - var(--base-width) * 0.5);
  11. padding-bottom: 0;
  12. `,
  13. ),
  14. )
  15. export const SidebarBase = () => css.cx(
  16. css`
  17. box-sizing: border-box;
  18. overflow: hidden;
  19. display: contents;
  20. left: calc(var(--base-width) * -1);
  21. `,
  22. css.media('(min-width: 1080px)')(
  23. css`
  24. position: fixed;
  25. top: 0;
  26. left: 0;
  27. width: calc(50% - var(--base-width) * 0.5);
  28. height: 100%;
  29. display: block;
  30. `,
  31. ),
  32. )
  33. export const SidebarMain = ({
  34. mainSidebarOpen,
  35. }: LayoutArgs) => css.cx(
  36. css`
  37. box-sizing: border-box;
  38. position: fixed;
  39. top: 0;
  40. width: 100%;
  41. height: 100%;
  42. padding-top: inherit;
  43. padding-bottom: var(--size-menu, 4rem);
  44. z-index: 2;
  45. > * {
  46. display: block;
  47. width: 100%;
  48. height: 100%;
  49. background-color: white;
  50. }
  51. `,
  52. css.media('(min-width: 1080px)')(
  53. css`
  54. position: absolute;
  55. right: 0;
  56. width: calc(var(--base-width) - var(--size-menu, 4rem));
  57. margin-left: 0;
  58. padding-bottom: 0;
  59. `,
  60. ),
  61. css.dynamic({
  62. right: mainSidebarOpen ? 0 : '100%',
  63. }),
  64. )
  65. export const SidebarMainOverflow = () => css.cx(
  66. css`
  67. width: 100%;
  68. height: 100%;
  69. overflow: auto; /* overflow: overlay */
  70. scrollbar-width: none;
  71. position: relative;
  72. z-index: 1;
  73. ::-webkit-scrollbar {
  74. display: none;
  75. }
  76. `
  77. )
  78. export const SidebarMenu = () => css.cx(
  79. css`
  80. box-sizing: border-box;
  81. overflow: auto; /* overflow: overlay */
  82. scrollbar-width: none;
  83. ::-webkit-scrollbar {
  84. display: none;
  85. }
  86. position: fixed;
  87. bottom: 0;
  88. left: 0;
  89. width: 100%;
  90. height: var(--size-menu, 4rem);
  91. z-index: 1;
  92. > * {
  93. display: block;
  94. width: 100%;
  95. height: 100%;
  96. background-color: white;
  97. }
  98. `,
  99. css.media('(min-width: 1080px)')(
  100. css`
  101. top: 0;
  102. margin-left: auto;
  103. position: absolute;
  104. height: 100%;
  105. padding-top: inherit;
  106. overflow: auto;
  107. z-index: auto;
  108. `,
  109. ),
  110. );
  111. export const SidebarMenuSize = () => css.cx(
  112. css`
  113. display: flex;
  114. width: 100%;
  115. height: 100%;
  116. max-width: calc(var(--base-width) * 2);
  117. margin: 0 auto;
  118. position: relative;
  119. z-index: 1;
  120. `,
  121. css.media('(min-width: 1080px)')(
  122. css`
  123. max-width: none;
  124. margin-right: 0;
  125. flex-direction: column;
  126. justify-content: space-between;
  127. align-items: flex-end;
  128. `,
  129. ),
  130. );
  131. export const SidebarMenuGroup = () => css.cx(
  132. css`
  133. display: contents;
  134. `,
  135. css.media('(min-width: 1080px)')(
  136. css`
  137. width: 100%;
  138. display: block;
  139. `,
  140. ),
  141. );
  142. export const MoreItems = ({
  143. mainSidebarOpen,
  144. }: LayoutArgs) => css.cx(
  145. css`
  146. position: fixed;
  147. top: 0;
  148. width: 100%;
  149. height: 100%;
  150. padding-top: var(--height-topbar, 4rem);
  151. padding-bottom: var(--size-menu, 4rem);
  152. z-index: -1;
  153. box-sizing: border-box;
  154. `,
  155. css.media('(min-width: 1080px)')(
  156. css`
  157. display: contents;
  158. `,
  159. ),
  160. css.dynamic({
  161. left: mainSidebarOpen ? 0 : '-100%',
  162. }),
  163. );
  164. export const MoreItemsScroll = () => css.cx(
  165. css`
  166. width: 100%;
  167. height: 100%;
  168. overflow: auto;
  169. `,
  170. css.media('(min-width: 1080px)')(
  171. css`
  172. display: contents;
  173. `,
  174. ),
  175. );
  176. export const MorePrimarySidebarMenuGroup = () => css.cx(
  177. css.media('(min-width: 1080px)')(
  178. css`
  179. flex: auto;
  180. `,
  181. ),
  182. );
  183. export const MoreSecondarySidebarMenuGroup = () => css.cx(
  184. css.media('(min-width: 1080px)')(
  185. css`
  186. order: 4;
  187. `,
  188. ),
  189. );
  190. export const SidebarMenuItem = () => css.cx(
  191. css`
  192. width: 0;
  193. flex: auto;
  194. height: var(--size-menu, 4rem);
  195. > * {
  196. height: 100%;
  197. display: flex;
  198. align-items: center;
  199. text-decoration: none;
  200. width: 100%;
  201. }
  202. `,
  203. css.media('(min-width: 1080px)')(
  204. css`
  205. width: auto !important;
  206. flex: 0 1 auto;
  207. > * {
  208. height: auto;
  209. }
  210. `
  211. ),
  212. );
  213. export const MoreSidebarMenuItem = () => css.cx(
  214. css`
  215. width: 0;
  216. flex: auto;
  217. height: var(--size-menu, 4rem);
  218. > * {
  219. height: 100%;
  220. display: flex;
  221. align-items: center;
  222. text-decoration: none;
  223. width: 100%;
  224. }
  225. `,
  226. css.media('(min-width: 1080px)')(
  227. css`
  228. width: auto !important;
  229. flex: 0 1 auto;
  230. `,
  231. ),
  232. );
  233. export const MoreToggleSidebarMenuItem = () => css.cx(
  234. css`
  235. width: 0;
  236. flex: auto;
  237. height: var(--size-menu, 4rem);
  238. > * {
  239. height: 100%;
  240. display: flex;
  241. align-items: center;
  242. text-decoration: none;
  243. width: 100%;
  244. }
  245. `,
  246. css.media('(min-width: 1080px)')(
  247. css`
  248. display: none;
  249. `,
  250. ),
  251. );
  252. export const SidebarMenuItemIcon = () => css.cx(
  253. css`
  254. display: block;
  255. `,
  256. css.media('(min-width: 1080px)')(
  257. css`
  258. width: var(--size-menu, 4rem);
  259. height: var(--size-menu, 4rem);
  260. display: grid;
  261. place-content: center;
  262. `,
  263. ),
  264. );
  265. export const MoreSidebarMenuItemItem = () => css.cx(
  266. css`
  267. margin-right: 1rem;
  268. display: block;
  269. `,
  270. css.media('(min-width: 1080px)')(
  271. css`
  272. width: var(--size-menu, 4rem);
  273. height: var(--size-menu, 4rem);
  274. display: grid;
  275. place-content: center;
  276. margin-right: 0;
  277. `,
  278. ),
  279. );
  280. export const SidebarMenuContainer = () => css.cx(
  281. css`
  282. box-sizing: border-box;
  283. display: grid;
  284. place-content: center;
  285. width: 100%;
  286. text-align: center;
  287. `,
  288. css.media('(min-width: 1080px)')(
  289. css`
  290. display: flex;
  291. justify-content: flex-start;
  292. align-items: center;
  293. margin-left: auto;
  294. padding-right: 1rem;
  295. text-align: left;
  296. box-sizing: border-box;
  297. width: var(--base-width);
  298. `,
  299. ),
  300. )
  301. export const MoreSidebarMenuContainer = () => css.cx(
  302. css`
  303. display: flex;
  304. justify-content: flex-start;
  305. align-items: center;
  306. width: calc(var(--base-width) * 2);
  307. margin: 0 auto;
  308. padding: 0 1rem;
  309. text-align: left;
  310. box-sizing: border-box;
  311. `,
  312. css.media('(min-width: 1080px)')(
  313. css`
  314. margin-right: 0;
  315. width: var(--base-width);
  316. padding-left: 0;
  317. `,
  318. ),
  319. );
  320. export const ContentContainer = () => css.cx(
  321. css`
  322. padding: 0 1rem;
  323. box-sizing: border-box;
  324. width: 100%;
  325. max-width: calc(var(--base-width) * 2);
  326. margin-right: auto;
  327. margin-left: auto;
  328. `,
  329. css.media('(min-width: 1080px)')(
  330. css`
  331. margin-left: 0;
  332. `,
  333. ),
  334. );
  335. export const SidebarMainContainer = () => css.cx(
  336. css`
  337. padding: 0 1rem;
  338. box-sizing: border-box;
  339. width: 100%;
  340. max-width: calc(var(--base-width) * 2);
  341. margin: 0 auto;
  342. `,
  343. css.media('(min-width: 1080px)')(
  344. css`
  345. max-width: none;
  346. `,
  347. ),
  348. );