mirror of
https://github.com/zadam/trilium.git
synced 2026-05-07 18:37:12 +02:00
feat(options/spellcheck): merge into single card
This commit is contained in:
@@ -45,3 +45,12 @@
|
||||
.option-row.centered {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.option-row.full-width {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.option-row.full-width .option-row-input {
|
||||
flex-shrink: unset;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,15 @@ interface OptionsRowProps {
|
||||
description?: string;
|
||||
children: VNode;
|
||||
centered?: boolean;
|
||||
fullWidth?: boolean;
|
||||
}
|
||||
|
||||
export default function OptionsRow({ name, label, description, children, centered }: OptionsRowProps) {
|
||||
export default function OptionsRow({ name, label, description, children, centered, fullWidth }: OptionsRowProps) {
|
||||
const id = useUniqueName(name);
|
||||
const childWithId = cloneElement(children, { id });
|
||||
|
||||
return (
|
||||
<div className={`option-row ${centered ? "centered" : ""}`}>
|
||||
<div className={`option-row ${centered ? "centered" : ""} ${fullWidth ? "full-width" : ""}`}>
|
||||
<div className="option-row-label">
|
||||
{label && <label for={id}>{label}</label>}
|
||||
{description && <small className="option-row-description">{description}</small>}
|
||||
|
||||
@@ -25,21 +25,19 @@ function ElectronSpellcheckSettings() {
|
||||
const [ spellCheckEnabled, setSpellCheckEnabled ] = useTriliumOptionBool("spellCheckEnabled");
|
||||
|
||||
return (
|
||||
<>
|
||||
<OptionsSection title={t("spellcheck.title")}>
|
||||
<FormText>{t("spellcheck.restart-required")}</FormText>
|
||||
<OptionsSection title={t("spellcheck.title")}>
|
||||
<FormText>{t("spellcheck.restart-required")}</FormText>
|
||||
|
||||
<OptionsRow name="spell-check-enabled" label={t("spellcheck.enable")}>
|
||||
<FormToggle
|
||||
switchOnName="" switchOffName=""
|
||||
currentValue={spellCheckEnabled}
|
||||
onChange={setSpellCheckEnabled}
|
||||
/>
|
||||
</OptionsRow>
|
||||
</OptionsSection>
|
||||
<OptionsRow name="spell-check-enabled" label={t("spellcheck.enable")}>
|
||||
<FormToggle
|
||||
switchOnName="" switchOffName=""
|
||||
currentValue={spellCheckEnabled}
|
||||
onChange={setSpellCheckEnabled}
|
||||
/>
|
||||
</OptionsRow>
|
||||
|
||||
{spellCheckEnabled && <SpellcheckLanguages />}
|
||||
</>
|
||||
</OptionsSection>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -74,7 +72,7 @@ function SpellcheckLanguages() {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<OptionsSection title={t("spellcheck.language_code_label")}>
|
||||
<OptionsRow name="spell-check-languages" label={t("spellcheck.language_code_label")} fullWidth>
|
||||
<CheckboxList
|
||||
values={availableLanguages}
|
||||
keyProperty="code" titleProperty="name"
|
||||
@@ -82,7 +80,7 @@ function SpellcheckLanguages() {
|
||||
onChange={setSelectedCodes}
|
||||
columnWidth="200px"
|
||||
/>
|
||||
</OptionsSection>
|
||||
</OptionsRow>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user