diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-04-05 18:56:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-05 18:56:02 -0500 |
commit | ea04c2bd330dc5b46d6f9df0d7d4619bbd8f56d0 (patch) | |
tree | 870c7d3dbffe1f382cba30b858eaa2b76b31af36 /src/lib/hooks | |
parent | 8e28d3c6be8e063b6d563b0068cb4fc907ff5df0 (diff) | |
download | voidsky-ea04c2bd330dc5b46d6f9df0d7d4619bbd8f56d0.tar.zst |
Add user invite codes (#393)
* Add mobile UIs for invite codes * Update invite code UIs for web * Finish implementing invite code behaviors (including notifications of invited users) * Bump deps * Update web right nav to use real data; also fix lint
Diffstat (limited to 'src/lib/hooks')
-rw-r--r-- | src/lib/hooks/useCustomPalette.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/hooks/useCustomPalette.ts b/src/lib/hooks/useCustomPalette.ts new file mode 100644 index 000000000..4f8f5c836 --- /dev/null +++ b/src/lib/hooks/useCustomPalette.ts @@ -0,0 +1,13 @@ +import React from 'react' +import {useTheme} from 'lib/ThemeContext' +import {choose} from 'lib/functions' + +export function useCustomPalette<T>({light, dark}: {light: T; dark: T}) { + const theme = useTheme() + return React.useMemo(() => { + return choose<T, Record<string, T>>(theme.colorScheme, { + dark, + light, + }) + }, [theme.colorScheme, dark, light]) +} |