@@ -2,12 +2,11 @@ import { useSetAtom } from 'jotai';
22import type { ReactNode } from 'react' ;
33import { useId , useRef } from 'react' ;
44import CrossSvg from '../assets/cross.svg' ;
5- import DiscordIconSvg from '../assets/discord-icon.svg' ;
6- import GithubIconSvg from '../assets/github-icon.svg' ;
75import HamburgerSvg from '../assets/hamburger.svg' ;
86import {
97 codeEditorShownAtom ,
108 experimentalExamplesShownAtom ,
9+ groupExamplesByCategoryAtom ,
1110 menuShownAtom ,
1211} from '../utils/examples/exampleViewStateAtoms.ts' ;
1312import { SearchableExampleList } from './SearchableExampleList.tsx' ;
@@ -52,14 +51,16 @@ function SideMenu() {
5251 experimentalExamplesShownAtom ,
5352 true ,
5453 ) ;
54+ const [ groupByCategory , setGroupByCategory ] = useHydratedAtom ( groupExamplesByCategoryAtom , false ) ;
5555 const scrollRef = useRef < HTMLDivElement > ( null ) ;
5656 const experimentalExamplesToggleId = useId ( ) ;
57+ const groupByCategoryToggleId = useId ( ) ;
5758
5859 return (
5960 < aside className = "absolute inset-0 z-50 box-border flex w-full flex-col bg-white md:static md:w-75 md:rounded-2xl" >
60- < header className = "p-5 " >
61+ < header className = "px-5 py-3 " >
6162 < div className = "grid place-items-center" >
62- < a href = "/TypeGPU" className = "box-border grid h-20 cursor-pointer place-content-center" >
63+ < a href = "/TypeGPU" className = "box-border grid h-12 cursor-pointer place-content-center" >
6364 < img className = "w-40" src = "/TypeGPU/typegpu-logo-light.svg" alt = "TypeGPU Logo" />
6465 </ a >
6566 </ div >
@@ -74,22 +75,9 @@ function SideMenu() {
7475 < hr className = "my-0 box-border w-full border-tameplum-100 border-t" />
7576 </ div >
7677
77- < div className = "my-5 min-h-0 flex-1 overflow-y-auto px-5" ref = { scrollRef } >
78- < section className = "mb-5 space-y-2 border-tameplum-100 border-b pb-5" >
79- < h1 className = "font-medium text-lg" > Welcome to examples page</ h1 >
80- < p className = "text-sm" >
81- Test out the power of our TypeScript library and get to know TypeGPU.
82- </ p >
83- < a
84- href = "/TypeGPU/why-typegpu"
85- className = "bg-gradient-to-r from-gradient-purple-dark to-gradient-blue-dark bg-clip-text text-sm text-transparent underline"
86- >
87- Learn more about TypeGPU here
88- </ a >
89- </ section >
90-
78+ < div className = "my-3 min-h-0 flex-1 overflow-y-auto px-5" ref = { scrollRef } >
9179 < SearchableExampleList
92- excludeTags = { experimentalShowing ? [ ] : [ 'experimental ' ] }
80+ excludeApis = { experimentalShowing ? [ ] : [ '~unstable ' ] }
9381 scrollContainerRef = { scrollRef }
9482 />
9583 </ div >
@@ -98,28 +86,30 @@ function SideMenu() {
9886 < hr className = "my-0 box-border w-full border-tameplum-100 border-t" />
9987 </ div >
10088
101- < label
102- htmlFor = { experimentalExamplesToggleId }
103- className = "flex cursor-pointer items-center justify-between gap-3 p-5 text-sm"
104- >
105- < span > Experimental examples</ span >
106- < Toggle
107- id = { experimentalExamplesToggleId }
108- checked = { experimentalShowing }
109- onChange = { ( e ) => setExperimentalShowing ( e . target . checked ) }
110- />
111- </ label >
112-
113- < div className = "flex justify-between px-5 pb-5 text-tameplum-800 text-xs" >
114- < div > © { new Date ( ) . getFullYear ( ) } Software Mansion S.A.</ div >
115- < div className = "flex items-center gap-3" >
116- < a href = "https://discord.gg/8jpfgDqPcM" target = "_blank" rel = "noreferrer" >
117- < img src = { DiscordIconSvg . src } className = "opacity-75" alt = "github logo" />
118- </ a >
119- < a href = "https://github.com/software-mansion/TypeGPU" target = "_blank" rel = "noreferrer" >
120- < img src = { GithubIconSvg . src } className = "opacity-75" alt = "discord logo" />
121- </ a >
122- </ div >
89+ < div className = "flex items-center gap-2 px-5 py-3 text-xs text-gray-600" >
90+ < label
91+ htmlFor = { experimentalExamplesToggleId }
92+ className = "flex flex-1 cursor-pointer items-center justify-between gap-2"
93+ >
94+ < span className = "whitespace-nowrap" > Experimental</ span >
95+ < Toggle
96+ id = { experimentalExamplesToggleId }
97+ checked = { experimentalShowing }
98+ onChange = { ( e ) => setExperimentalShowing ( e . target . checked ) }
99+ />
100+ </ label >
101+ < div className = "h-4 w-px shrink-0 bg-tameplum-100" />
102+ < label
103+ htmlFor = { groupByCategoryToggleId }
104+ className = "flex flex-1 cursor-pointer items-center justify-between gap-2"
105+ >
106+ < span className = "whitespace-nowrap" > Grouped</ span >
107+ < Toggle
108+ id = { groupByCategoryToggleId }
109+ checked = { groupByCategory }
110+ onChange = { ( e ) => setGroupByCategory ( e . target . checked ) }
111+ />
112+ </ label >
123113 </ div >
124114 </ aside >
125115 ) ;
0 commit comments