feat: Custom accent color (#4897)
* types * Working, but messy * Add InputColor component * types * Show default theme values when not customized * Support custom theme on team sign-in page * Payload validation * Custom theme on shared documents * Improve theme validation * Team -> Workspace in settings
This commit is contained in:
@@ -1,26 +1,19 @@
|
||||
import { observer } from "mobx-react";
|
||||
import * as React from "react";
|
||||
import { ThemeProvider } from "styled-components";
|
||||
import { breakpoints } from "@shared/styles";
|
||||
import GlobalStyles from "@shared/styles/globals";
|
||||
import { dark, light, lightMobile, darkMobile } from "@shared/styles/theme";
|
||||
import { UserPreference } from "@shared/types";
|
||||
import useMediaQuery from "~/hooks/useMediaQuery";
|
||||
import { TeamPreference, UserPreference } from "@shared/types";
|
||||
import useBuildTheme from "~/hooks/useBuildTheme";
|
||||
import useStores from "~/hooks/useStores";
|
||||
import { TooltipStyles } from "./Tooltip";
|
||||
|
||||
const Theme: React.FC = ({ children }) => {
|
||||
const { auth, ui } = useStores();
|
||||
const resolvedTheme = ui.resolvedTheme === "dark" ? dark : light;
|
||||
const resolvedMobileTheme =
|
||||
ui.resolvedTheme === "dark" ? darkMobile : lightMobile;
|
||||
const isMobile = useMediaQuery(`(max-width: ${breakpoints.tablet}px)`);
|
||||
const isPrinting = useMediaQuery("print");
|
||||
const theme = isPrinting
|
||||
? light
|
||||
: isMobile
|
||||
? resolvedMobileTheme
|
||||
: resolvedTheme;
|
||||
const theme = useBuildTheme(
|
||||
auth.team?.getPreference(TeamPreference.CustomTheme) ||
|
||||
auth.config?.customTheme ||
|
||||
undefined
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
window.dispatchEvent(
|
||||
|
||||
Reference in New Issue
Block a user