mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 15:49:00 +02:00
refactor(react/settings): use separate components inside same file
This commit is contained in:
parent
83e1512b59
commit
d42a949602
@ -25,23 +25,18 @@ const BUILTIN_THEMES: Theme[] = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export default function AppearanceSettings() {
|
export default function AppearanceSettings() {
|
||||||
const [ layoutOrientation, setLayoutOrientation ] = useTriliumOption("layoutOrientation", true);
|
|
||||||
const [ theme, setTheme ] = useTriliumOption("theme", true);
|
|
||||||
const [ overrideThemeFonts, setOverrideThemeFonts ] = useTriliumOptionBool("overrideThemeFonts");
|
|
||||||
|
|
||||||
const [ themes, setThemes ] = useState<Theme[]>([]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
server.get<Theme[]>("options/user-themes").then((userThemes) => {
|
|
||||||
setThemes([
|
|
||||||
...BUILTIN_THEMES,
|
|
||||||
...userThemes
|
|
||||||
])
|
|
||||||
});
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<LayoutOrientation />
|
||||||
|
<ApplicationTheme />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function LayoutOrientation() {
|
||||||
|
const [ layoutOrientation, setLayoutOrientation ] = useTriliumOption("layoutOrientation", true);
|
||||||
|
|
||||||
|
return (
|
||||||
<OptionsSection title={t("theme.layout")}>
|
<OptionsSection title={t("theme.layout")}>
|
||||||
{!isMobile() && <FormRadioGroup
|
{!isMobile() && <FormRadioGroup
|
||||||
name="layout-orientation"
|
name="layout-orientation"
|
||||||
@ -58,7 +53,25 @@ export default function AppearanceSettings() {
|
|||||||
currentValue={layoutOrientation} onChange={setLayoutOrientation}
|
currentValue={layoutOrientation} onChange={setLayoutOrientation}
|
||||||
/>}
|
/>}
|
||||||
</OptionsSection>
|
</OptionsSection>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ApplicationTheme() {
|
||||||
|
const [ theme, setTheme ] = useTriliumOption("theme", true);
|
||||||
|
const [ overrideThemeFonts, setOverrideThemeFonts ] = useTriliumOptionBool("overrideThemeFonts");
|
||||||
|
|
||||||
|
const [ themes, setThemes ] = useState<Theme[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
server.get<Theme[]>("options/user-themes").then((userThemes) => {
|
||||||
|
setThemes([
|
||||||
|
...BUILTIN_THEMES,
|
||||||
|
...userThemes
|
||||||
|
])
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
<OptionsSection title={t("theme.title")}>
|
<OptionsSection title={t("theme.title")}>
|
||||||
<Column>
|
<Column>
|
||||||
<label>{t("theme.theme_label")}</label>
|
<label>{t("theme.theme_label")}</label>
|
||||||
@ -72,6 +85,5 @@ export default function AppearanceSettings() {
|
|||||||
currentValue={overrideThemeFonts} onChange={setOverrideThemeFonts} />
|
currentValue={overrideThemeFonts} onChange={setOverrideThemeFonts} />
|
||||||
</Column>
|
</Column>
|
||||||
</OptionsSection>
|
</OptionsSection>
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user