Template for starting apps, powered by Next.js
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.

index.tsx 2.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. import * as React from 'react'
  2. import * as T from '@tesseract-design/react-common'
  3. import { LeftSidebarWithMenu } from '@tesseract-design/viewfinder'
  4. import DummyContent from '../../molecules/DummyContent'
  5. import Link from '../../molecules/Link'
  6. import Brand from '../../molecules/Brand'
  7. type Props = {
  8. query: string,
  9. sidebarMainOpen: boolean,
  10. menuLinkLabel: string,
  11. userLinkLabel: string,
  12. moreItemsOpen: boolean,
  13. searchQueryKey: string,
  14. searchLabel: string,
  15. searchHint: string,
  16. popupQueryKey: string,
  17. moreQueryKey: string,
  18. sidebarQueryKey: string,
  19. moreLinkLabel: string,
  20. sidebarMenuItems: LeftSidebarWithMenu.MenuItem[],
  21. userPopupQueryValue: string,
  22. }
  23. const LeftSidebarLayoutTemplate: React.FC<Props> = ({
  24. query,
  25. sidebarMainOpen,
  26. menuLinkLabel,
  27. userLinkLabel,
  28. moreItemsOpen,
  29. searchQueryKey,
  30. searchLabel,
  31. searchHint,
  32. popupQueryKey,
  33. moreQueryKey,
  34. sidebarQueryKey,
  35. moreLinkLabel,
  36. sidebarMenuItems,
  37. userPopupQueryValue,
  38. }) => {
  39. return (
  40. <LeftSidebarWithMenu.Layout
  41. brand={
  42. <Brand />
  43. }
  44. topBarCenter={
  45. <form>
  46. <T.TextInput
  47. name={searchQueryKey}
  48. label={searchLabel}
  49. hint={searchHint}
  50. defaultValue={query}
  51. border
  52. alternate
  53. />
  54. </form>
  55. }
  56. menuLink={
  57. <Link
  58. href={{
  59. query: {
  60. [sidebarQueryKey]: '',
  61. },
  62. }}
  63. >
  64. <T.Icon
  65. name="menu"
  66. label={menuLinkLabel}
  67. />
  68. </Link>
  69. }
  70. userLink={
  71. <Link
  72. href={{
  73. query: {
  74. [popupQueryKey]: userPopupQueryValue,
  75. },
  76. }}
  77. >
  78. <T.Icon
  79. name="user"
  80. label={userLinkLabel}
  81. />
  82. </Link>
  83. }
  84. moreLinkMenuItem={{
  85. label: moreLinkLabel,
  86. url: {
  87. query: {
  88. [moreQueryKey]: '',
  89. },
  90. },
  91. icon: (
  92. <T.Icon
  93. name="more-horizontal"
  94. label=""
  95. />
  96. ),
  97. }}
  98. moreItemsOpen={moreItemsOpen}
  99. moreLinkComponent={({ url, icon, label, }) => (
  100. <Link
  101. href={url}
  102. >
  103. <LeftSidebarWithMenu.MoreSidebarMenuContainer>
  104. <LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
  105. {icon}
  106. </LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
  107. {label}
  108. </LeftSidebarWithMenu.MoreSidebarMenuContainer>
  109. </Link>
  110. )}
  111. linkComponent={({ url, icon, label, }) => (
  112. <Link
  113. href={url}
  114. >
  115. <LeftSidebarWithMenu.SidebarMenuContainer>
  116. <LeftSidebarWithMenu.SidebarMenuItemIcon>
  117. {icon}
  118. </LeftSidebarWithMenu.SidebarMenuItemIcon>
  119. {label}
  120. </LeftSidebarWithMenu.SidebarMenuContainer>
  121. </Link>
  122. )}
  123. sidebarMainOpen={sidebarMainOpen}
  124. sidebarMain={
  125. <LeftSidebarWithMenu.SidebarMainContainer>
  126. <DummyContent />
  127. </LeftSidebarWithMenu.SidebarMainContainer>
  128. }
  129. sidebarMenuItems={sidebarMenuItems}
  130. >
  131. <LeftSidebarWithMenu.ContentContainer>
  132. <DummyContent />
  133. </LeftSidebarWithMenu.ContentContainer>
  134. </LeftSidebarWithMenu.Layout>
  135. )
  136. }
  137. export default LeftSidebarLayoutTemplate