Design system.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

204 řádky
7.0 KiB

  1. import * as React from 'react';
  2. import {Layouts, Widgets} from '@tesseract-design/viewfinder-react';
  3. import Link from 'next/link';
  4. import {Brand} from '@/components/Brand';
  5. import {DropdownSelect} from '@tesseract-design/web-choice-react';
  6. export interface Page {
  7. id: string;
  8. href: string;
  9. label: string;
  10. }
  11. export interface DocsLayoutProps {
  12. componentPages?: { name: string; components: Page[] }[];
  13. docsPages?: Page[];
  14. examplePages?: Page[];
  15. sidebarOpen?: boolean;
  16. children?: React.ReactNode;
  17. }
  18. const createSidebarPageLink = (p: Page) => (
  19. <div
  20. key={p.id}
  21. >
  22. <Link
  23. href={p.href}
  24. className="no-underline font-semibold m-0 p-0 leading-none h-8 flex items-center cursor-pointer uppercase text-sm"
  25. >
  26. <Layouts.LeftSidebar.SidebarContentContainer>
  27. {p.label}
  28. </Layouts.LeftSidebar.SidebarContentContainer>
  29. </Link>
  30. </div>
  31. );
  32. export const DocsLayout: React.FC<DocsLayoutProps> = ({
  33. sidebarOpen = false,
  34. componentPages = [],
  35. docsPages = [],
  36. examplePages = [],
  37. children,
  38. }) => {
  39. return (
  40. <Layouts.LeftSidebar.Root
  41. topBarWidget={
  42. <Widgets.TopBar
  43. span="wide"
  44. brand={
  45. <Link
  46. href="/"
  47. className="no-underline block"
  48. >
  49. <Brand />
  50. </Link>
  51. }
  52. menuLink={
  53. <Link
  54. href={{
  55. query: {
  56. open: 'sidebar',
  57. },
  58. }}
  59. className="no-underline p-0 m-0"
  60. >
  61. <svg
  62. className="w-6 h-6 fill-none stroke-current stroke-2 linejoin-round linecap-round"
  63. viewBox="0 0 24 24"
  64. role="presentation"
  65. >
  66. <line x1="3" y1="12" x2="21" y2="12"/>
  67. <line x1="3" y1="6" x2="21" y2="6"/>
  68. <line x1="3" y1="18" x2="21" y2="18"/>
  69. </svg>
  70. </Link>
  71. }
  72. />
  73. }
  74. sidebarBaseWidget={
  75. <Widgets.LeftSidebarBase
  76. open={sidebarOpen}
  77. >
  78. <div className="min-h-full py-4 box-border flex flex-col gap-8">
  79. <div>
  80. <nav>
  81. <Layouts.LeftSidebar.SidebarContentContainer>
  82. <h1>
  83. Docs
  84. </h1>
  85. </Layouts.LeftSidebar.SidebarContentContainer>
  86. <div className="flex flex-col gap-2 my-8">
  87. {docsPages?.map(createSidebarPageLink)}
  88. </div>
  89. </nav>
  90. <nav>
  91. <Layouts.LeftSidebar.SidebarContentContainer>
  92. <h1>
  93. Platforms
  94. </h1>
  95. </Layouts.LeftSidebar.SidebarContentContainer>
  96. <div className="flex flex-col gap-2 my-8">
  97. <Layouts.LeftSidebar.SidebarContentContainer>
  98. <div className="flex gap-8">
  99. <Link
  100. href={{
  101. pathname: '[...url]',
  102. query: {
  103. url: ['web', 'react'],
  104. },
  105. }}
  106. className="no-underline font-semibold leading-none h-8 flex items-center cursor-pointer uppercase text-sm"
  107. >
  108. React
  109. </Link>
  110. <Link
  111. href={{
  112. pathname: '[...url]',
  113. query: {
  114. url: ['web', 'vue'],
  115. },
  116. }}
  117. className="no-underline font-semibold leading-none h-8 flex items-center cursor-pointer uppercase text-sm"
  118. >
  119. Vue
  120. </Link>
  121. <Link
  122. href={{
  123. pathname: '[...url]',
  124. query: {
  125. url: ['web', 'solid'],
  126. },
  127. }}
  128. className="no-underline font-semibold leading-none h-8 flex items-center cursor-pointer uppercase text-sm"
  129. >
  130. Solid
  131. </Link>
  132. </div>
  133. </Layouts.LeftSidebar.SidebarContentContainer>
  134. </div>
  135. </nav>
  136. {/*<div>*/}
  137. {/* <Layouts.LeftSidebar.SidebarContentContainer>*/}
  138. {/* <h1>*/}
  139. {/* Categories*/}
  140. {/* </h1>*/}
  141. {/* </Layouts.LeftSidebar.SidebarContentContainer>*/}
  142. {/* {componentPages.map(({name, components}) => (*/}
  143. {/* <nav key={name}>*/}
  144. {/* <h2>*/}
  145. {/* <Layouts.LeftSidebar.SidebarContentContainer>*/}
  146. {/* {name}*/}
  147. {/* </Layouts.LeftSidebar.SidebarContentContainer>*/}
  148. {/* </h2>*/}
  149. {/* <div className="flex flex-col gap-2 my-8">*/}
  150. {/* {components?.map(createSidebarPageLink)}*/}
  151. {/* </div>*/}
  152. {/* </nav>*/}
  153. {/* ))}*/}
  154. {/*</div>*/}
  155. {/*<nav>*/}
  156. {/* <Layouts.LeftSidebar.SidebarContentContainer>*/}
  157. {/* <h1>*/}
  158. {/* Examples*/}
  159. {/* </h1>*/}
  160. {/* </Layouts.LeftSidebar.SidebarContentContainer>*/}
  161. {/* <div className="flex flex-col gap-4 my-4">*/}
  162. {/* {examplePages?.map(createSidebarPageLink)}*/}
  163. {/* </div>*/}
  164. {/*</nav>*/}
  165. </div>
  166. <div className="mb-8">
  167. <Layouts.LeftSidebar.SidebarContentContainer>
  168. <div className="flex gap-8">
  169. <Link
  170. href="https://code.modal.sh/tesseract-design/tesseract"
  171. className="no-underline font-semibold leading-none h-8 flex items-center cursor-pointer uppercase text-sm"
  172. >
  173. Repo
  174. </Link>
  175. <Link
  176. href="https://code.modal.sh/tesseract-design/tesseract"
  177. className="no-underline font-semibold leading-none h-8 flex items-center cursor-pointer uppercase text-sm"
  178. >
  179. Website
  180. </Link>
  181. <Link
  182. href="https://code.modal.sh/tesseract-design/tesseract/issues"
  183. className="no-underline font-semibold leading-none h-8 flex items-center cursor-pointer uppercase text-sm"
  184. >
  185. Issues
  186. </Link>
  187. </div>
  188. </Layouts.LeftSidebar.SidebarContentContainer>
  189. </div>
  190. </div>
  191. </Widgets.LeftSidebarBase>
  192. }
  193. >
  194. <Layouts.LeftSidebar.MainContentContainer>
  195. {children}
  196. </Layouts.LeftSidebar.MainContentContainer>
  197. </Layouts.LeftSidebar.Root>
  198. )
  199. };