feat(ui): wrap the YAML editor at the pane or a set print width, with an appearance setting

This commit is contained in:
sam committed 2026-10-19 09:41:03 +11:00
1 parent f4d0b45672
commit b2eba7a8f0
5 files changed
+206 -131

No files matched your search

+28 -3
View File
@@ -7,14 +7,16 @@ import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import {
type Density,
type Motion,
PRINT_WIDTHS,
type PrintWidth,
type Theme,
useAppearanceStore,
} from "@/stores/appearance";
import ConfigCard from "./ConfigCard.vue";
const appearance = useAppearanceStore();
const { density, motion, overscroll, theme, tooltipsEnabled } = storeToRefs(appearance);
const { setDensity, setMotion, setOverscroll, setTheme, setTooltips } = appearance;
const { density, motion, overscroll, printWidth, theme, tooltipsEnabled } = storeToRefs(appearance);
const { setDensity, setMotion, setOverscroll, setPrintWidth, setTheme, setTooltips } = appearance;
/**
* Appearance: how the dashboard looks, on this browser. These preferences are
@@ -30,6 +32,10 @@ function chooseDensity(value: unknown): void {
setDensity(value as Density);
}
function choosePrintWidth(value: unknown): void {
if (PRINT_WIDTHS.includes(value as PrintWidth)) setPrintWidth(value as PrintWidth);
}
function chooseMotion(value: unknown): void {
if (value === "system" || value === "reduced") setMotion(value as Motion);
}
@@ -42,7 +48,7 @@ function chooseMotion(value: unknown): void {
<ConfigCard
title="Dashboard preferences"
>
<div class="grid gap-8 md:grid-cols-2 lg:grid-cols-5">
<div class="grid gap-8 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6">
<section class="flex min-w-0 flex-col items-start">
<div>
<h2 id="appearance-theme" class="text-sm font-medium">Theme</h2>
@@ -118,6 +124,25 @@ function chooseMotion(value: unknown): void {
@update:model-value="setOverscroll"
/>
</section>
<section class="flex min-w-0 flex-col items-start">
<div>
<h2 id="appearance-print-width" class="text-sm font-medium">Print width</h2>
</div>
<ToggleGroup
type="single"
variant="outline"
:model-value="printWidth"
class="mt-4"
aria-labelledby="appearance-print-width"
@update:model-value="choosePrintWidth"
>
<ToggleGroupItem value="window">Window</ToggleGroupItem>
<ToggleGroupItem value="80">80</ToggleGroupItem>
<ToggleGroupItem value="100">100</ToggleGroupItem>
<ToggleGroupItem value="120">120</ToggleGroupItem>
</ToggleGroup>
</section>
</div>
</ConfigCard>
</div>