11// import { createMemo, type Component } from 'solid-js';
22
3+ import packageJSON from 'src/../package.json' ;
4+
35// Hooks
46import { UseClickOutsideExample } from 'dev/components/examples/use-click-outside/use-click-outside.example' ;
57import { UseElementSizeExample } from 'dev/components/examples/use-element-size/use-element-size.example' ;
@@ -15,7 +17,7 @@ import { UseResizeObserverExample } from 'dev/components/examples/use-resize-obs
1517import { UseToggleExample } from 'dev/components/examples/use-toggle/use-toggle.example' ;
1618import { IconCheck , IconCopy , IconGithub , IconLogo } from 'dev/icons' ;
1719import { createMemo , createSignal , For , Show } from 'solid-js' ;
18- import { useOs , useToggle } from 'src' ;
20+ import { useLocalStorage , useOs } from 'src' ;
1921
2022export default function HomePage ( ) {
2123 // // let ref = useClickOutside(() =>
@@ -95,7 +97,19 @@ export default function HomePage() {
9597 } ) ;
9698
9799 const [ copied , setCopied ] = createSignal ( false ) ;
98- const [ pkgManager , togglePkgManager ] = useToggle ( [ 'npm' , 'bun' , 'pnpm' , 'yarn' ] as const ) ;
100+ const [ pkgManager , setPackageManager ] = useLocalStorage ( {
101+ key : 'preferred-pkg-manager' ,
102+ defaultValue : 'npm' ,
103+ } ) ;
104+ function togglePkgManager ( ) {
105+ setPackageManager ( current => {
106+ if ( current === 'npm' ) return 'bun' ;
107+ if ( current === 'bun' ) return 'pnpm' ;
108+ if ( current === 'pnpm' ) return 'yarn' ;
109+ if ( current === 'yarn' ) return 'npm' ;
110+ return 'npm' ;
111+ } ) ;
112+ }
99113 const pkgManagerColor = createMemo ( ( ) => {
100114 if ( pkgManager ( ) === 'npm' ) return '#E5312F' ;
101115 if ( pkgManager ( ) === 'bun' ) return '#FBF0DF' ;
@@ -116,7 +130,13 @@ export default function HomePage() {
116130 < div class = "mx-auto flex w-full max-w-4xl flex-col gap-y-5 px-4 py-20" >
117131 < IconLogo width = { 80 } height = { 80 } variant = "inverted" class = "self-center" />
118132
119- < h1 class = "text-center text-5xl font-medium text-white" > Bagon Hooks</ h1 >
133+ < div class = "relative mx-auto flex w-max justify-center gap-x-2" >
134+ < h1 class = "text-center text-5xl font-medium text-white" > Bagon Hooks</ h1 >
135+ < span class = "absolute bottom-0 left-full mx-2 text-base text-muted" >
136+ v{ packageJSON . version }
137+ </ span >
138+ </ div >
139+
120140 < p class = "text-center text-neutral-50" >
121141 A collection of zero-dependency hooks for SolidJS forked directly from Mantine Hooks, with
122142 some improvements.
0 commit comments