Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: palette and icons for shared and linked content #92

Merged
merged 2 commits into from
Jun 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion src/boot/theme-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,38 @@ const themeSizes = (
}
};

const paletteExtension =
(): ThemeExtension =>
(t: any): any => {
geeky-abhishek marked this conversation as resolved.
Show resolved Hide resolved
// eslint-disable-next-line no-param-reassign
t.palette.shared = {
regular: '#FFB74D',
hover: '#FFA21A',
active: '#FFA21A',
focus: '#FF9800',
disabled: '#FFD699'
};
// eslint-disable-next-line no-param-reassign
t.palette.linked = {
regular: '#AB47BC',
hover: '#8B3899',
active: '#8B3899',
focus: '#7A3187',
disabled: '#DDB4E4'
};
return t;
};

const iconExtension =
(): ThemeExtension =>
(t: any): any => {
// eslint-disable-next-line no-param-reassign
t.icons.Shared = t.icons.ArrowCircleRight;
// eslint-disable-next-line no-param-reassign
t.icons.Linked = t.icons.ArrowCircleLeft;
return t;
};

export const ThemeProvider: FC = ({ children }) => {
const zimbraPrefFontSize = useAccountStore((s) => s.settings.prefs?.zimbraPrefFontSize as string);
// TODO: update when the DS is fully typed :D
Expand All @@ -99,7 +131,9 @@ export const ThemeProvider: FC = ({ children }) => {
useEffect(() => {
setExtensions((e) => ({
...e,
fonts: themeSizes(zimbraPrefFontSize)
fonts: themeSizes(zimbraPrefFontSize),
palette: paletteExtension(),
icons: iconExtension()
}));
}, [zimbraPrefFontSize]);
const [darkReaderState, setDarkReaderState] = useState<'auto' | 'disabled' | 'enabled'>('auto');
Expand Down Expand Up @@ -134,6 +168,7 @@ export const ThemeProvider: FC = ({ children }) => {
const addExtension = useCallback((newExtension: ThemeExtension, id: string) => {
setExtensions((ext) => ({ ...ext, [id]: newExtension }));
}, []);

return (
<UIThemeProvider extension={aggregatedExtensions}>
<ThemeCallbacksContext.Provider value={{ addExtension, setDarkReaderState }}>
Expand Down