Skip to content

Build your personal knowledge base with Trilium Notes

feat(options/appearance): improve content width section

Elian Doran92d011503d68
diff --git a/apps/client/src/stylesheets/theme-next/pages.css b/apps/client/src/stylesheets/theme-next/pages.css
index 5348b706ac..047c4c91fb 100644
--- a/apps/client/src/stylesheets/theme-next/pages.css
+++ b/apps/client/src/stylesheets/theme-next/pages.css
@@ -238,6 +238,13 @@ body.desktop .options-section:not(.tn-no-card) {
margin-inline-start: auto;
}
+.options-section-description {
+ color: var(--muted-text-color);
+ font-size: 13px;
+ margin-top: 0;
+ margin-bottom: 16px;
+}
+
.options-section:not(.tn-no-card) h5 {
font-size: var(--options-title-font-size);
font-weight: bold;
diff --git a/apps/client/src/widgets/type_widgets/options/appearance.tsx b/apps/client/src/widgets/type_widgets/options/appearance.tsx
index 3be65ba14e..591b329d20 100644
--- a/apps/client/src/widgets/type_widgets/options/appearance.tsx
+++ b/apps/client/src/widgets/type_widgets/options/appearance.tsx
@@ -11,12 +11,10 @@ import server from "../../../services/server";
import { isElectron, isMobile, reloadFrontendApp, restartDesktopApp } from "../../../services/utils";
import { VerticalLayoutIcon } from "../../buttons/global_menu";
import Button from "../../react/Button";
-import Column from "../../react/Column";
import FormCheckbox from "../../react/FormCheckbox";
import FormGroup from "../../react/FormGroup";
import FormList, { FormListHeader, FormListItem } from "../../react/FormList";
import FormSelect from "../../react/FormSelect";
-import FormText from "../../react/FormText";
import { FormTextBoxWithUnit } from "../../react/FormTextBox";
import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import Icon from "../../react/Icon";
@@ -589,22 +587,21 @@ function MaxContentWidth() {
const [centerContent, setCenterContent] = useTriliumOptionBool("centerContent");
return (
- <OptionsSection title={t("max_content_width.title")}>
- <FormText>{t("max_content_width.default_description")}</FormText>
-
- <Column md={6}>
- <FormGroup name="max-content-width" label={t("max_content_width.max_width_label")}>
- <FormTextBoxWithUnit
- type="number" min={MIN_CONTENT_WIDTH} step="10"
- currentValue={maxContentWidth} onBlur={setMaxContentWidth}
- unit={t("max_content_width.max_width_unit")}
- />
- </FormGroup>
- </Column>
-
- <FormCheckbox label={t("max_content_width.centerContent")}
+ <OptionsSection title={t("max_content_width.title")} description={t("max_content_width.default_description")}>
+ <OptionsRow name="max-content-width" label={t("max_content_width.max_width_label")}>
+ <FormTextBoxWithUnit
+ type="number" min={MIN_CONTENT_WIDTH} step="10"
+ currentValue={maxContentWidth} onBlur={setMaxContentWidth}
+ unit={t("max_content_width.max_width_unit")}
+ />
+ </OptionsRow>
+
+ <OptionsRowWithToggle
+ name="center-content"
+ label={t("max_content_width.centerContent")}
currentValue={centerContent}
- onChange={setCenterContent} />
+ onChange={setCenterContent}
+ />
</OptionsSection>
);
}
diff --git a/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx b/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx
index 18c86e7d2f..6a724ca545 100644
--- a/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx
+++ b/apps/client/src/widgets/type_widgets/options/components/OptionsSection.tsx
@@ -5,6 +5,7 @@ import ActionButton from "../../../react/ActionButton";
interface OptionsSectionProps {
title?: ComponentChildren;
+ description?: string;
children: ComponentChildren;
noCard?: boolean;
style?: CSSProperties;
@@ -12,7 +13,7 @@ interface OptionsSectionProps {
helpUrl?: string;
}
-export default function OptionsSection({ title, children, noCard, className, helpUrl, ...rest }: OptionsSectionProps) {
+export default function OptionsSection({ title, description, children, noCard, className, helpUrl, ...rest }: OptionsSectionProps) {
return (
<div className={`options-section ${noCard ? "tn-no-card" : ""} ${className ?? ""}`} {...rest}>
{(title || helpUrl) && (
@@ -27,6 +28,7 @@ export default function OptionsSection({ title, children, noCard, className, hel
)}
</div>
)}
+ {description && <p className="options-section-description">{description}</p>}
{children}
</div>
);