1- import { Footer , LabelWithWrapping , ProjectTemplate , TableOfContent } from ' @sb/components' ;
1+ import { Footer , ProjectTemplate , TableOfContent } from ' @sb/components' ;
22import NextLogo from ' @sb/images/logo-nextjs.svg' ;
33import ReactRouterLogo from ' @sb/images/logo-react-router.svg' ;
44import ViteLogo from ' @sb/images/logo-vitejs.svg' ;
55import { Meta } from ' @storybook/addon-docs/blocks' ;
66import { FlexBox , FlexBoxJustifyContent , FlexBoxWrap , Label } from ' @ui5/webcomponents-react' ;
7+ import projectTemplates from ' ./project-templates.json' ;
8+
9+ export const logos = {
10+ nextjs: NextLogo ,
11+ vite: ViteLogo ,
12+ ' react-router' : ReactRouterLogo ,
13+ };
14+
15+ export const repoBase = ' https://github.com/UI5/webcomponents-react/tree/main/' ;
716
817<Meta title = " Project Templates & Examples" />
918
@@ -18,113 +27,52 @@ A curated list of minimal project templates and examples to get started using UI
1827<br />
1928
2029<FlexBox wrap = { FlexBoxWrap .Wrap } style = { { width: ' 100%' , gap: ' 1rem' }} justifyContent = { FlexBoxJustifyContent .Start } >
21- <ProjectTemplate
22- title = { ' Next.js' }
23- subtitle = { ' App Router' }
24- logo = { NextLogo }
25- logoAttribution = { ' Next.js Logo. Original Source: https://vercel.com/design/brands#next-js' }
26- href = { ' https://github.com/UI5/webcomponents-react/tree/main/templates/nextjs-app' }
27- stackBlitzHref = " https://stackblitz.com/github/UI5/webcomponents-react/tree/main/templates/nextjs-app"
28- isTypeScript
29- isTemplate
30- />
31- <ProjectTemplate
32- title = { ' Next.js' }
33- subtitle = { ' Pages Router' }
34- logo = { NextLogo }
35- logoAttribution = { ' Next.js Logo. Original Source: https://vercel.com/design/brands#next-js' }
36- href = { ' https://github.com/UI5/webcomponents-react/tree/main/templates/nextjs-pages' }
37- isTypeScript
38- isTemplate
39- />
40- <ProjectTemplate
41- title = { ' Vite.js' }
42- logo = { ViteLogo }
43- logoAttribution = { ' Vite.js Logo. Original Source: https://github.com/vitejs/vite/blob/main/docs/public/logo.svg ' }
44- href = { ' https://github.com/UI5/webcomponents-react/tree/main/templates/vite-ts' }
45- isTypeScript
46- isTemplate
47- stackBlitzHref = " https://stackblitz.com/github/UI5/webcomponents-react/tree/main/templates/vite-ts?file=src%2FApp.tsx"
48- />
30+ { projectTemplates
31+ .filter ((t ) => t .type === ' template' )
32+ .map ((t ) => (
33+ <ProjectTemplate
34+ key = { t .path }
35+ title = { t .name }
36+ subtitle = { t .variant }
37+ logo = { logos [t .logo ]}
38+ logoAttribution = { t .logoAttribution }
39+ href = { ` ${repoBase }${t .path } ` }
40+ stackBlitzHref = { t .stackBlitz }
41+ isTypeScript = { t .typescript }
42+ isTemplate
43+ />
44+ ))}
4945</FlexBox >
5046
5147## Examples
5248
5349<br />
5450
5551<FlexBox wrap = { FlexBoxWrap .Wrap } style = { { width: ' 100%' , gap: ' 1rem' }} justifyContent = { FlexBoxJustifyContent .Start } >
56- <ProjectTemplate
57- title = { ' Next.js' }
58- subtitle = { ' App Router' }
59- logo = { NextLogo }
60- logoAttribution = { ' Next.js Logo. Original Source: https://vercel.com/design/brands#next-js' }
61- href = { ' https://github.com/UI5/webcomponents-react/tree/main/examples/nextjs-app' }
62- stackBlitzHref = " https://stackblitz.com/github/UI5/webcomponents-react/tree/main/examples/nextjs-app"
63- isTypeScript
64- >
65- <ul >
66- <li >
67- <Label >Next.js Template using the App Router</Label >
68- </li >
69- <li >
70- <Label >Data Fetching using React Server Components</Label >
71- </li >
72- </ul >
73- </ProjectTemplate >
74- <ProjectTemplate
75- title = { ' Next.js' }
76- subtitle = { ' Pages Router' }
77- logo = { NextLogo }
78- logoAttribution = { ' Next.js Logo. Original Source: https://vercel.com/design/brands#next-js' }
79- href = { ' https://github.com/UI5/webcomponents-react/tree/main/examples/nextjs-pages' }
80- isTypeScript
81- >
82- <ul >
83- <li >
84- <Label >Next.js Template using the Pages Router</Label >
85- </li >
86- <li >
87- <Label >API Routes</Label >
88- </li >
89- </ul >
90- </ProjectTemplate >
91- <ProjectTemplate
92- title = { ' Vite.js' }
93- logo = { ViteLogo }
94- logoAttribution = { ' Vite.js Logo. Original Source: https://github.com/vitejs/vite/blob/main/docs/public/logo.svg ' }
95- href = { ' https://github.com/UI5/webcomponents-react/tree/main/examples/vite-ts' }
96- isTypeScript
97- stackBlitzHref = " https://stackblitz.com/github/UI5/webcomponents-react/tree/main/examples/vite-ts?file=src%2Fmain.tsx"
98- >
99- <ul >
100- <li >
101- <LabelWithWrapping >{ ` Routing and Data Fetching using the createBrowserRouter of React Router v7 ` } </LabelWithWrapping >
102- </li >
103- <li >
104- <Label >Cypress Component & E2E Test setup</Label >
105- </li >
106- <li >
107- <Label >Theming</Label >
108- </li >
109- </ul >
110- </ProjectTemplate >
111- <ProjectTemplate
112- title = { ' React Router v7' }
113- subtitle = { ' Previously: Remix Template' }
114- logo = { ReactRouterLogo }
115- logoAttribution = { ' React Router Logo. Original Source: https://reactrouter.com' }
116- href = { ' https://github.com/UI5/webcomponents-react/tree/main/examples/react-router-ts' }
117- isTypeScript
118- >
119- <ul >
120- <li >
121- <Label >{ ` React Router v7 with server side rendering ` } </Label >
122- </li >
123- <li >
124- <Label >Theming</Label >
125- </li >
126- </ul >
127- </ProjectTemplate >
52+ { projectTemplates
53+ .filter ((t ) => t .type === ' example' )
54+ .map ((t ) => (
55+ <ProjectTemplate
56+ key = { t .path }
57+ title = { t .name }
58+ subtitle = { t .variant }
59+ logo = { logos [t .logo ]}
60+ logoAttribution = { t .logoAttribution }
61+ href = { ` ${repoBase }${t .path } ` }
62+ stackBlitzHref = { t .stackBlitz }
63+ isTypeScript = { t .typescript }
64+ >
65+ { t .features && (
66+ <ul >
67+ { t .features .map ((f ) => (
68+ <li key = { f } >
69+ <Label >{ f } </Label >
70+ </li >
71+ ))}
72+ </ul >
73+ )}
74+ </ProjectTemplate >
75+ ))}
12876</FlexBox >
12977
13078<Footer />
0 commit comments