-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
675 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './steppedRange' | ||
export * from './withCache' | ||
export * from './withCopyToClipboard' | ||
export * from './withPerformanceLog' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './useRangeInput' | ||
export * from './useSetupClientState' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { usePrevious } from '@mantine/hooks' | ||
import { type PrimitiveAtom, useAtom } from 'jotai/index' | ||
import { useHydrateAtoms } from 'jotai/utils' | ||
import { useEffect } from 'react' | ||
|
||
import { setCookie } from '~/app/action' | ||
|
||
export const useSetupClientState = <T,>( | ||
atom: PrimitiveAtom<T>, | ||
savedValue: T, | ||
cookieName: string, | ||
) => { | ||
const [value, setValue] = useAtom(atom) | ||
|
||
useEffect(() => { | ||
setValue(savedValue) | ||
}, [savedValue, setValue]) | ||
|
||
const prevValue = usePrevious(value) | ||
|
||
useEffect(() => { | ||
if (prevValue !== value) { | ||
void setCookie( | ||
cookieName, | ||
typeof value === 'string' ? value : JSON.stringify(value), | ||
) | ||
} | ||
}, [cookieName, prevValue, value]) | ||
|
||
useHydrateAtoms([[atom, savedValue]]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
Inter, | ||
Lexend, | ||
Roboto_Condensed, | ||
Source_Serif_4, | ||
} from 'next/font/google' | ||
import localFont from 'next/font/local' | ||
|
||
export const fontSans = localFont({ | ||
src: [ | ||
{ path: './fonts/Geist-Regular.woff2', weight: '400' }, | ||
{ | ||
path: './fonts/Geist-Regular.otf', | ||
weight: '400', | ||
}, | ||
{ path: './fonts/Geist-Bold.woff2', weight: '700' }, | ||
{ path: './fonts/Geist-Bold.otf', weight: '700' }, | ||
], | ||
variable: '--font-sans', | ||
}) | ||
|
||
export const fontMono = localFont({ | ||
src: [ | ||
{ path: './fonts/GeistMono-Regular.woff2', weight: '400' }, | ||
{ | ||
path: './fonts/GeistMono-Regular.otf', | ||
weight: '400', | ||
}, | ||
{ path: './fonts/GeistMono-UltraBlack.woff2', weight: '700' }, | ||
{ path: './fonts/GeistMono-UltraBlack.otf', weight: '700' }, | ||
], | ||
variable: '--font-mono', | ||
}) | ||
|
||
export const fontClean = Inter({ | ||
weight: ['400', '700'], | ||
style: ['normal'], | ||
display: 'swap', | ||
variable: '--font-clean', | ||
subsets: ['latin', 'latin-ext'], | ||
}) | ||
|
||
export const fontDyslexic = Lexend({ | ||
weight: ['400', '700'], | ||
display: 'swap', | ||
variable: '--font-dyslexic', | ||
subsets: ['latin', 'latin-ext'], | ||
}) | ||
|
||
export const fontCondensed = Roboto_Condensed({ | ||
weight: ['400', '700'], | ||
style: ['normal'], | ||
display: 'swap', | ||
variable: '--font-condensed', | ||
subsets: ['latin', 'latin-ext'], | ||
}) | ||
|
||
export const fontOldStyle = Source_Serif_4({ | ||
weight: ['400', '700'], | ||
display: 'swap', | ||
variable: '--font-old-style', | ||
subsets: ['latin', 'latin-ext'], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
export * from './Root.layout' | ||
export { fontOldStyle } from '~/layouts/RootLayout/fonts' | ||
export { fontCondensed } from '~/layouts/RootLayout/fonts' | ||
export { fontDyslexic } from '~/layouts/RootLayout/fonts' | ||
export { fontClean } from '~/layouts/RootLayout/fonts' | ||
export { fontMono } from '~/layouts/RootLayout/fonts' | ||
export { fontSans } from '~/layouts/RootLayout/fonts' |
Oops, something went wrong.