Skip to content

Commit

Permalink
Add ability to reset custom theme
Browse files Browse the repository at this point in the history
  • Loading branch information
tommoor committed Apr 18, 2023
1 parent c52909f commit f91cdc3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
26 changes: 23 additions & 3 deletions app/scenes/Settings/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { buildDarkTheme, buildLightTheme } from "@shared/styles/theme";
import { CustomTheme } from "@shared/types";
import { getBaseDomain } from "@shared/utils/domains";
import Button from "~/components/Button";
import ButtonLink from "~/components/ButtonLink";
import DefaultCollectionInputSelect from "~/components/DefaultCollectionInputSelect";
import Heading from "~/components/Heading";
import Input from "~/components/Input";
Expand All @@ -31,8 +32,10 @@ function Details() {
const team = useCurrentTeam();
const theme = useTheme();
const form = useRef<HTMLFormElement>(null);
const [accent, setAccent] = useState(team.preferences?.customTheme?.accent);
const [accentText, setAccentText] = useState(
const [accent, setAccent] = useState<null | undefined | string>(
team.preferences?.customTheme?.accent
);
const [accentText, setAccentText] = useState<null | undefined | string>(
team.preferences?.customTheme?.accentText
);
const [name, setName] = useState(team.name);
Expand Down Expand Up @@ -177,7 +180,24 @@ function Details() {
border={false}
label={t("Theme")}
name="accent"
description={t("Customize the interface look and feel.")}
description={
<>
{t("Customize the interface look and feel.")}{" "}
{accent && (
<>
<ButtonLink
onClick={() => {
setAccent(null);
setAccentText(null);
}}
>
{t("Reset theme")}
</ButtonLink>
.
</>
)}
</>
}
>
<InputColor
id="accent"
Expand Down
1 change: 1 addition & 0 deletions shared/i18n/locales/en_US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,7 @@
"The workspace name, usually the same as your company name.": "The workspace name, usually the same as your company name.",
"Theme": "Theme",
"Customize the interface look and feel.": "Customize the interface look and feel.",
"Reset theme": "Reset theme",
"Accent color": "Accent color",
"Accent text color": "Accent text color",
"Behavior": "Behavior",
Expand Down

0 comments on commit f91cdc3

Please sign in to comment.