Open History to see the last commit
1import {
2 BASE_FONT_SIZE_STEP,
3 MAX_BASE_FONT_SIZE,
4 MIN_BASE_FONT_SIZE,
5} from "../../../../lib/appearancePreferences";
6import { SettingsSection } from "../../components/SettingsSection";
7import { useAppearancePreferences } from "../AppearancePreferencesProvider";
8import {
9 AppearancePreviewSeparator,
10 TextAppearancePreview,
11} from "../components/AppearancePreviews";
12import { FontSizeSliderRow } from "../components/FontSizeSliderRow";
13import { SettingsSwitchRow } from "../../components/SettingsSwitchRow";
14
15export function TextAppearanceSection() {
16 const { isReady, appearance, setBaseFontSize, mathRenderingEnabled, setMathRenderingEnabled } =
17 useAppearancePreferences();
18
19 return (
20 <SettingsSection title="Text">
21 <TextAppearancePreview fontSize={appearance.baseFontSize} />
22 <AppearancePreviewSeparator />
23 <FontSizeSliderRow
24 disabled={!isReady}
25 icon="textformat.size"
26 label="Text size"
27 max={MAX_BASE_FONT_SIZE}
28 min={MIN_BASE_FONT_SIZE}
29 onChange={setBaseFontSize}
30 step={BASE_FONT_SIZE_STEP}
31 value={appearance.baseFontSize}
32 valueLabel={`${appearance.baseFontSize} pt`}
33 />
34 <SettingsSwitchRow
35 disabled={!isReady}
36 icon="plusminus"
37 label="Render math"
38 value={mathRenderingEnabled}
39 onValueChange={setMathRenderingEnabled}
40 />
41 </SettingsSection>
42 );
43}