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

141 lines
2.9 KiB

  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