Layout scaffolding for Web apps.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

layouts.left-sidebar-with-menu.tsx 2.2 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import { Layouts, Widgets } from '@tesseract-design/viewfinder-react';
  2. import {Span} from '@tesseract-design/viewfinder-base';
  3. import {Brand} from '~/components/Brand';
  4. import {DummyLinks} from '~/components/DummyLinks';
  5. import {useSearchParams, Link} from '@remix-run/react';
  6. const LeftSidebarWithMenuLayoutPage = () => {
  7. const params = useSearchParams();
  8. const { open } = Object.fromEntries(params.entries()) as unknown as Record<string, string>;
  9. const sidebarOpen = open === 'sidebar';
  10. return (
  11. <Layouts.LeftSidebarWithMenu.Root
  12. sidebarBaseWidget={
  13. <Widgets.LeftSidebarWithMenuBase
  14. span={Span.WIDE}
  15. open={sidebarOpen}
  16. style={{
  17. backgroundColor: 'inherit',
  18. }}
  19. items={[
  20. {
  21. id: '1',
  22. label: 'Item 1',
  23. icon: '1',
  24. url: '#',
  25. }
  26. ]}
  27. linkComponent={({
  28. url,
  29. label,
  30. icon,
  31. }) => (
  32. <a
  33. href={url}
  34. >
  35. <Layouts.LeftSidebarWithMenu.SidebarContentContainer>
  36. <Layouts.LeftSidebarWithMenu.SidebarContentContainer>
  37. {icon}
  38. </Layouts.LeftSidebarWithMenu.SidebarContentContainer>
  39. {label}
  40. </Layouts.LeftSidebarWithMenu.SidebarContentContainer>
  41. </a>
  42. )}
  43. >
  44. <Layouts.LeftSidebarWithMenu.SidebarContentContainer>
  45. Sidebar
  46. </Layouts.LeftSidebarWithMenu.SidebarContentContainer>
  47. </Widgets.LeftSidebarWithMenuBase>
  48. }
  49. topBarWidget={
  50. <Widgets.TopBar
  51. brand={
  52. <Brand />
  53. }
  54. style={{
  55. backgroundColor: 'inherit',
  56. }}
  57. menuLink={
  58. <Link
  59. to="?open=sidebar"
  60. >
  61. Open
  62. </Link>
  63. }
  64. span={Span.WIDE}
  65. >
  66. <DummyLinks />
  67. </Widgets.TopBar>
  68. }
  69. >
  70. <Layouts.LeftSidebarWithMenu.MainContentContainer>
  71. Hello
  72. </Layouts.LeftSidebarWithMenu.MainContentContainer>
  73. </Layouts.LeftSidebarWithMenu.Root>
  74. )
  75. }
  76. export default LeftSidebarWithMenuLayoutPage