1 import { c } from 'ttag';
3 import { Button } from '@proton/atoms';
4 import Info from '@proton/components/components/link/Info';
5 import type { ModalProps } from '@proton/components/components/modalTwo/Modal';
6 import ModalTwo from '@proton/components/components/modalTwo/Modal';
7 import ModalTwoContent from '@proton/components/components/modalTwo/ModalContent';
8 import ModalTwoFooter from '@proton/components/components/modalTwo/ModalFooter';
9 import ModalTwoHeader from '@proton/components/components/modalTwo/ModalHeader';
10 import Toggle from '@proton/components/components/toggle/Toggle';
11 import { BRAND_NAME } from '@proton/shared/lib/constants';
12 import { ColorScheme, ThemeModeSetting, getThemes } from '@proton/shared/lib/themes/themes';
14 import ThemeCards from './ThemeCards';
15 import { useTheme } from './ThemeProvider';
16 import ThemeSyncModeCard from './ThemeSyncModeCard';
18 const ThemesModal = (props: ModalProps) => {
19 const { information, settings, setTheme, setAutoTheme } = useTheme();
21 const themes = getThemes();
24 <ModalTwo size="large" {...props}>
25 <ModalTwoHeader title={c('Title').t`Select a theme`} />
27 <p className="mb-4">{c('Info').t`Customize the look and feel of ${BRAND_NAME} applications.`}</p>
28 <div className="inline-flex mb-4">
29 <label htmlFor="themeSyncToggle" className="text-semibold">
30 <span className="mr-2">{c('Label').t`Sync with system`}</span>
33 .t`Automatically switch between your preferred themes for day and night in sync with your system’s day and night modes`}
39 checked={settings.Mode === ThemeModeSetting.Auto}
40 onChange={(e) => setAutoTheme(e.target.checked)}
43 {settings.Mode === ThemeModeSetting.Auto ? (
44 <div className="flex flex-nowrap gap-4 flex-column md:flex-row">
50 themeIdentifier={settings.LightTheme}
51 onChange={(themeType) => {
52 setTheme(themeType, ThemeModeSetting.Light);
54 active={information.colorScheme === ColorScheme.Light}
61 themeIdentifier={settings.DarkTheme}
62 onChange={(themeType) => {
63 setTheme(themeType, ThemeModeSetting.Dark);
65 active={information.colorScheme === ColorScheme.Dark}
71 themeIdentifier={information.theme}
72 onChange={(themeType) => {
79 <Button color="norm" className="ml-auto" onClick={props.onClose}>{c('Action').t`OK`}</Button>
85 export default ThemesModal;