App for making pecha kucha presentations.
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.
 
 

179 lignes
3.9 KiB

  1. import * as React from 'react'
  2. import styled from 'styled-components'
  3. import * as T from '@tesseract-design/react-common'
  4. import {LeftSidebarWithMenu} from '@theoryofnekomata/viewfinder'
  5. import DummyContent from '../../molecules/DummyContent'
  6. import Link from '../../molecules/Link'
  7. import Brand from '../../molecules/Brand'
  8. const TopBarComponent = styled('div')({
  9. backgroundColor: 'var(--color-bg, white)',
  10. '::before': {
  11. content: "''",
  12. width: '100%',
  13. height: '100%',
  14. position: 'absolute',
  15. top: 0,
  16. left: 0,
  17. pointerEvents: 'none',
  18. },
  19. '::after': {
  20. backgroundColor: 'black',
  21. opacity: 0.5,
  22. content: "''",
  23. width: '100%',
  24. height: '100%',
  25. position: 'absolute',
  26. top: 0,
  27. left: 0,
  28. pointerEvents: 'none',
  29. },
  30. })
  31. const SidebarMainComponent = styled('div')({
  32. backgroundColor: 'var(--color-bg, white)',
  33. zIndex: 2,
  34. '::after': {
  35. backgroundColor: 'black',
  36. opacity: 0.25,
  37. content: "''",
  38. width: '100%',
  39. height: '100%',
  40. position: 'absolute',
  41. top: 0,
  42. left: 0,
  43. pointerEvents: 'none',
  44. },
  45. })
  46. const SidebarMenuComponent = styled('div')({
  47. backgroundColor: 'var(--color-bg, white)',
  48. '::after': {
  49. backgroundColor: 'black',
  50. opacity: 0.4,
  51. content: "''",
  52. width: '100%',
  53. height: '100%',
  54. position: 'absolute',
  55. top: 0,
  56. left: 0,
  57. pointerEvents: 'none',
  58. },
  59. })
  60. type Props = {
  61. query: string
  62. menuLinkLabel: string
  63. userLinkLabel: string
  64. searchQueryKey: string
  65. searchLabel: string
  66. searchHint: string
  67. popupQueryKey: string
  68. moreSubpageQueryValue: string
  69. sidebarSubpageQueryValue: string
  70. moreLinkLabel: string
  71. sidebarMenuItems: LeftSidebarWithMenu.MenuItem[]
  72. userPopupQueryValue: string
  73. subpageQueryKey: string
  74. subpage: string
  75. }
  76. const LeftSidebarLayoutTemplate: React.FC<Props> = ({
  77. query,
  78. menuLinkLabel,
  79. userLinkLabel,
  80. searchQueryKey,
  81. searchLabel,
  82. searchHint,
  83. popupQueryKey,
  84. moreSubpageQueryValue,
  85. sidebarSubpageQueryValue,
  86. moreLinkLabel,
  87. sidebarMenuItems,
  88. userPopupQueryValue,
  89. subpageQueryKey,
  90. subpage,
  91. }) => {
  92. return (
  93. <LeftSidebarWithMenu.Layout
  94. brand={<Brand />}
  95. sidebarMainComponent={SidebarMainComponent}
  96. sidebarMenuComponent={SidebarMenuComponent}
  97. topBarComponent={TopBarComponent}
  98. topBarCenter={
  99. <form>
  100. <T.TextInput
  101. name={searchQueryKey}
  102. label={searchLabel}
  103. hint={searchHint}
  104. defaultValue={query}
  105. border
  106. alternate
  107. />
  108. </form>
  109. }
  110. menuLink={
  111. <Link
  112. href={{
  113. query: {
  114. [subpageQueryKey]: sidebarSubpageQueryValue,
  115. },
  116. }}
  117. >
  118. <T.Icon name="menu" label={menuLinkLabel} />
  119. </Link>
  120. }
  121. userLink={
  122. <Link
  123. href={{
  124. query: {
  125. [popupQueryKey]: userPopupQueryValue,
  126. },
  127. }}
  128. >
  129. <T.Icon name="user" label={userLinkLabel} />
  130. </Link>
  131. }
  132. moreLinkMenuItem={{
  133. label: moreLinkLabel,
  134. url: {
  135. query: {
  136. [subpageQueryKey]: moreSubpageQueryValue,
  137. },
  138. },
  139. icon: <T.Icon name="more-horizontal" label="" />,
  140. }}
  141. moreItemsOpen={subpage === moreSubpageQueryValue}
  142. moreLinkComponent={({url, icon, label}) => (
  143. <Link href={url}>
  144. <LeftSidebarWithMenu.MoreSidebarMenuContainer>
  145. <LeftSidebarWithMenu.MoreSidebarMenuItemIcon>{icon}</LeftSidebarWithMenu.MoreSidebarMenuItemIcon>
  146. {label}
  147. </LeftSidebarWithMenu.MoreSidebarMenuContainer>
  148. </Link>
  149. )}
  150. linkComponent={({url, icon, label}) => (
  151. <Link href={url}>
  152. <LeftSidebarWithMenu.SidebarMenuContainer>
  153. <LeftSidebarWithMenu.SidebarMenuItemIcon>{icon}</LeftSidebarWithMenu.SidebarMenuItemIcon>
  154. {label}
  155. </LeftSidebarWithMenu.SidebarMenuContainer>
  156. </Link>
  157. )}
  158. sidebarMainOpen={subpage === sidebarSubpageQueryValue}
  159. sidebarMain={
  160. <LeftSidebarWithMenu.SidebarMainContainer>
  161. <DummyContent />
  162. </LeftSidebarWithMenu.SidebarMainContainer>
  163. }
  164. sidebarMenuItems={sidebarMenuItems}
  165. >
  166. <LeftSidebarWithMenu.ContentContainer>
  167. <DummyContent />
  168. </LeftSidebarWithMenu.ContentContainer>
  169. </LeftSidebarWithMenu.Layout>
  170. )
  171. }
  172. export default LeftSidebarLayoutTemplate