Skip to content

Commit a195351

Browse files
committed
feat(theme): compact preview cards, up to 4 per row
Grid capped at 4 columns; each theme preview rendered at natural size then scaled 0.5 into a half-height box, so cards are denser and internals half-size.
1 parent 24a18e1 commit a195351

1 file changed

Lines changed: 179 additions & 161 deletions

File tree

‎src/components/general/ThemePicker.vue‎

Lines changed: 179 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,197 +1,212 @@
11
<template>
2-
<div class="space-y-5">
3-
<div class="flex flex-wrap gap-6">
4-
<button
5-
v-for="t in cards"
6-
:key="t.id"
7-
type="button"
8-
class="w-[360px] max-w-full rounded-xl border p-3 text-left align-top transition-transform hover:-translate-y-0.5"
2+
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
3+
<button
4+
v-for="t in cards"
5+
:key="t.id"
6+
type="button"
7+
class="w-full rounded-xl border p-3 text-left align-top transition-transform hover:-translate-y-0.5"
8+
:style="{
9+
background: t.tokens.bg,
10+
borderColor: selected === t.id ? t.tokens.brand : t.tokens.border,
11+
boxShadow: selected === t.id ? '0 0 0 2px ' + t.tokens.brand : 'none',
12+
}"
13+
@click="choose(t.id)"
14+
>
15+
<!-- name + tag -->
16+
<div class="mb-2 flex items-center gap-2">
17+
<span
18+
class="inline-block h-2.5 w-2.5 rounded-full"
19+
:style="{ background: t.tokens.brand }"
20+
></span>
21+
<span
22+
class="text-[13px] font-semibold"
23+
:style="{ color: t.tokens.text }"
24+
>{{ t.name }}</span
25+
>
26+
<span
27+
class="font-mono text-[9px] uppercase tracking-wide"
28+
:style="{ color: t.tokens.muted }"
29+
>{{ t.tag }}</span
30+
>
31+
<span
32+
v-if="selected === t.id"
33+
class="ml-auto rounded-full px-1.5 py-0.5 text-[9px] font-semibold"
34+
:style="{ background: t.tokens.brand, color: t.tokens.onAccent }"
35+
>active</span
36+
>
37+
</div>
38+
39+
<!-- swatches -->
40+
<div class="mb-2 flex gap-1">
41+
<span
42+
v-for="(c, i) in [
43+
t.tokens.bg,
44+
t.tokens.surface,
45+
t.tokens.border,
46+
t.tokens.brand,
47+
t.tokens.timer,
48+
]"
49+
:key="i"
50+
class="h-3 flex-1 rounded"
51+
:style="{ background: c, outline: '1px solid ' + t.tokens.border }"
52+
></span>
53+
</div>
54+
55+
<!-- live mini preview (rendered at natural size, scaled to half) -->
56+
<div
57+
class="overflow-hidden rounded-lg"
958
:style="{
59+
height: '132px',
60+
border: '1px solid ' + t.tokens.border,
1061
background: t.tokens.bg,
11-
borderColor: selected === t.id ? t.tokens.brand : t.tokens.border,
12-
boxShadow:
13-
selected === t.id ? '0 0 0 2px ' + t.tokens.brand : 'none',
1462
}"
15-
@click="choose(t.id)"
1663
>
17-
<!-- name + tag -->
18-
<div class="mb-3 flex items-center gap-2">
19-
<span
20-
class="inline-block h-3 w-3 rounded-full"
21-
:style="{ background: t.tokens.brand }"
22-
></span>
23-
<span
24-
class="text-[15px] font-semibold"
25-
:style="{ color: t.tokens.text }"
26-
>{{ t.name }}</span
27-
>
28-
<span
29-
class="font-mono text-[11px] uppercase tracking-wide"
30-
:style="{ color: t.tokens.muted }"
31-
>{{ t.tag }}</span
32-
>
33-
<span
34-
v-if="selected === t.id"
35-
class="ml-auto rounded-full px-2 py-0.5 text-[10px] font-semibold"
36-
:style="{ background: t.tokens.brand, color: t.tokens.onAccent }"
37-
>active</span
38-
>
39-
</div>
40-
41-
<!-- swatches -->
42-
<div class="mb-3 flex gap-1.5">
43-
<span
44-
v-for="(c, i) in [
45-
t.tokens.bg,
46-
t.tokens.surface,
47-
t.tokens.border,
48-
t.tokens.brand,
49-
t.tokens.timer,
50-
]"
51-
:key="i"
52-
class="h-4 flex-1 rounded"
53-
:style="{
54-
background: c,
55-
outline: '1px solid ' + t.tokens.border,
56-
}"
57-
></span>
58-
</div>
59-
60-
<!-- live mini preview -->
6164
<div
62-
class="flex h-[260px] overflow-hidden rounded-lg"
6365
:style="{
64-
border: '1px solid ' + t.tokens.border,
65-
background: t.tokens.bg,
66+
transform: 'scale(0.5)',
67+
transformOrigin: 'top left',
68+
width: '200%',
6669
}"
6770
>
68-
<!-- icon rail -->
69-
<div
70-
class="flex w-10 flex-col items-center gap-3 py-3"
71-
:style="{
72-
background: t.tokens.bg,
73-
borderRight: '1px solid ' + t.tokens.border,
74-
}"
75-
>
76-
<span
77-
class="flex h-5 w-5 items-center justify-center rounded text-[11px] font-bold"
78-
:style="{ background: t.tokens.brand, color: t.tokens.onAccent }"
79-
>Y</span
80-
>
81-
<span
82-
class="flex h-4 w-4 items-center justify-center rounded text-[10px]"
83-
:style="{ background: t.tokens.raised, color: t.tokens.text }"
84-
>▦</span
85-
>
86-
<span class="text-[11px]" :style="{ color: t.tokens.muted }">☰</span>
87-
<span class="text-[11px]" :style="{ color: t.tokens.muted }">▥</span>
88-
<span
89-
class="mt-auto flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-semibold"
90-
:style="{ background: t.tokens.raised, color: t.tokens.muted }"
91-
>Y</span
92-
>
93-
</div>
94-
95-
<!-- main -->
96-
<div class="flex-1 overflow-hidden px-3 py-2.5">
97-
<div
98-
class="mb-2 font-mono text-[9px]"
99-
:style="{ color: t.tokens.muted }"
100-
>
101-
TMGR.DEV &nbsp;›&nbsp; Tasks (1955)
102-
</div>
71+
<div class="flex h-[264px]" :style="{ background: t.tokens.bg }">
72+
<!-- icon rail -->
10373
<div
104-
class="mb-2.5 text-center text-[17px] font-bold"
105-
:style="{ color: t.tokens.text }"
74+
class="flex w-10 flex-col items-center gap-3 py-3"
75+
:style="{
76+
background: t.tokens.bg,
77+
borderRight: '1px solid ' + t.tokens.border,
78+
}"
10679
>
107-
14618 hours 16 min
108-
</div>
109-
<div class="mb-2.5 flex gap-1.5">
110-
<div
111-
class="flex-1 rounded-md px-2.5 py-1.5 text-[11px]"
80+
<span
81+
class="flex h-5 w-5 items-center justify-center rounded text-[11px] font-bold"
11282
:style="{
113-
background: t.tokens.surface,
114-
border: '1px solid ' + t.tokens.border,
115-
color: t.tokens.muted,
83+
background: t.tokens.brand,
84+
color: t.tokens.onAccent,
11685
}"
86+
>Y</span
11787
>
118-
search task
119-
</div>
120-
<div
121-
class="flex h-7 w-7 items-center justify-center rounded-md text-[11px]"
122-
:style="{
123-
background: t.tokens.surface,
124-
border: '1px solid ' + t.tokens.border,
125-
color: t.tokens.muted,
126-
}"
88+
<span
89+
class="flex h-4 w-4 items-center justify-center rounded text-[10px]"
90+
:style="{ background: t.tokens.raised, color: t.tokens.text }"
91+
>▦</span
92+
>
93+
<span class="text-[11px]" :style="{ color: t.tokens.muted }"
94+
>☰</span
95+
>
96+
<span class="text-[11px]" :style="{ color: t.tokens.muted }"
97+
>▥</span
12798
>
128-
⋮
129-
</div>
130-
</div>
131-
<div
132-
v-for="row in previewRows"
133-
:key="row.date"
134-
class="mb-1.5 rounded-lg px-2.5 py-2"
135-
:style="{
136-
background: t.tokens.surface,
137-
border: '1px solid ' + t.tokens.border,
138-
}"
139-
>
14099
<span
141-
class="mb-1.5 inline-block rounded px-1.5 py-0.5 font-mono text-[8px] tracking-wide"
100+
class="mt-auto flex h-5 w-5 items-center justify-center rounded-full text-[10px] font-semibold"
142101
:style="{ background: t.tokens.raised, color: t.tokens.muted }"
143-
>CURRENT.PROJECT</span
102+
>Y</span
103+
>
104+
</div>
105+
106+
<!-- main -->
107+
<div class="flex-1 overflow-hidden px-3 py-2.5">
108+
<div
109+
class="mb-2 font-mono text-[9px]"
110+
:style="{ color: t.tokens.muted }"
144111
>
112+
TMGR.DEV &nbsp;›&nbsp; Tasks (1955)
113+
</div>
145114
<div
146-
class="mb-1.5 font-mono text-[13px]"
115+
class="mb-2.5 text-center text-[17px] font-bold"
147116
:style="{ color: t.tokens.text }"
148117
>
149-
{{ row.date }}
118+
14618 hours 16 min
150119
</div>
151-
<div class="flex items-center gap-1.5">
152-
<span class="text-[11px]" :style="{ color: t.tokens.timer }"
153-
>◷</span
120+
<div class="mb-2.5 flex gap-1.5">
121+
<div
122+
class="flex-1 rounded-md px-2.5 py-1.5 text-[11px]"
123+
:style="{
124+
background: t.tokens.surface,
125+
border: '1px solid ' + t.tokens.border,
126+
color: t.tokens.muted,
127+
}"
154128
>
155-
<span
156-
class="text-[12px] font-medium"
157-
:style="{ color: t.tokens.text }"
158-
>{{ row.time }}</span
129+
search task
130+
</div>
131+
<div
132+
class="flex h-7 w-7 items-center justify-center rounded-md text-[11px]"
133+
:style="{
134+
background: t.tokens.surface,
135+
border: '1px solid ' + t.tokens.border,
136+
color: t.tokens.muted,
137+
}"
159138
>
139+
⋮
140+
</div>
141+
</div>
142+
<div
143+
v-for="row in previewRows"
144+
:key="row.date"
145+
class="mb-1.5 rounded-lg px-2.5 py-2"
146+
:style="{
147+
background: t.tokens.surface,
148+
border: '1px solid ' + t.tokens.border,
149+
}"
150+
>
160151
<span
161-
class="flex h-4 w-4 items-center justify-center rounded text-[9px]"
152+
class="mb-1.5 inline-block rounded px-1.5 py-0.5 font-mono text-[8px] tracking-wide"
162153
:style="{
163-
background: t.tokens.timer,
164-
color: t.tokens.onAccent,
154+
background: t.tokens.raised,
155+
color: t.tokens.muted,
165156
}"
166-
>▶</span
157+
>CURRENT.PROJECT</span
158+
>
159+
<div
160+
class="mb-1.5 font-mono text-[13px]"
161+
:style="{ color: t.tokens.text }"
167162
>
163+
{{ row.date }}
164+
</div>
165+
<div class="flex items-center gap-1.5">
166+
<span class="text-[11px]" :style="{ color: t.tokens.timer }"
167+
>◷</span
168+
>
169+
<span
170+
class="text-[12px] font-medium"
171+
:style="{ color: t.tokens.text }"
172+
>{{ row.time }}</span
173+
>
174+
<span
175+
class="flex h-4 w-4 items-center justify-center rounded text-[9px]"
176+
:style="{
177+
background: t.tokens.timer,
178+
color: t.tokens.onAccent,
179+
}"
180+
>▶</span
181+
>
182+
</div>
168183
</div>
169184
</div>
170185
</div>
171186
</div>
187+
</div>
172188

173-
<!-- default light/dark toggle -->
174-
<div
175-
v-if="t.id === 'default'"
176-
class="mt-3 flex items-center gap-2"
177-
@click.stop
189+
<!-- default light/dark toggle -->
190+
<div
191+
v-if="t.id === 'default'"
192+
class="mt-2 flex items-center gap-2"
193+
@click.stop
194+
>
195+
<span class="text-[11px]" :style="{ color: t.tokens.muted }">Mode:</span>
196+
<span
197+
class="cursor-pointer rounded-full px-2 py-0.5 text-[11px]"
198+
:style="modeStyle('default', t.tokens)"
199+
@click="chooseScheme('default')"
200+
>Light</span
178201
>
179-
<span class="text-xs" :style="{ color: t.tokens.muted }">Mode:</span>
180-
<span
181-
class="cursor-pointer rounded-full px-2.5 py-1 text-xs"
182-
:style="modeStyle('default', t.tokens)"
183-
@click="chooseScheme('default')"
184-
>Light</span
185-
>
186-
<span
187-
class="cursor-pointer rounded-full px-2.5 py-1 text-xs"
188-
:style="modeStyle('dark', t.tokens)"
189-
@click="chooseScheme('dark')"
190-
>Dark</span
191-
>
192-
</div>
193-
</button>
194-
</div>
202+
<span
203+
class="cursor-pointer rounded-full px-2 py-0.5 text-[11px]"
204+
:style="modeStyle('dark', t.tokens)"
205+
@click="chooseScheme('dark')"
206+
>Dark</span
207+
>
208+
</div>
209+
</button>
195210
</div>
196211
</template>
197212

@@ -258,7 +273,10 @@
258273
const selected = computed(() => store.state.theme || 'default');
259274
const colorScheme = computed(() => store.state.colorScheme || 'default');
260275
261-
function modeStyle(mode: string, tokens: { brand: string; onAccent: string; muted: string; border: string }) {
276+
function modeStyle(
277+
mode: string,
278+
tokens: { brand: string; onAccent: string; muted: string; border: string },
279+
) {
262280
const on = colorScheme.value === mode;
263281
return {
264282
background: on ? tokens.brand : 'transparent',

0 commit comments

Comments
 (0)