Skip to content

Commit f95235f

Browse files
committed
fix(ui): unify compact control sizing
1 parent 6cf942e commit f95235f

2 files changed

Lines changed: 65 additions & 17 deletions

File tree

entrypoints/devtools-panel/devtools-panel.vue

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const PropertyNode = defineComponent({
193193
<div class="flex shrink-0 items-center gap-2">
194194
<div
195195
data-testid="header-stats"
196-
class="hidden h-9 items-center gap-2 rounded-md border border-border px-3 text-xs text-muted-foreground md:flex"
196+
class="hidden h-8 items-center gap-1.5 rounded-md border border-border px-2.5 text-xs text-muted-foreground md:flex"
197197
>
198198
<span class="font-medium text-foreground">{{ changedCount }}</span>
199199
<span>{{ t('changed') }}</span>
@@ -207,11 +207,11 @@ const PropertyNode = defineComponent({
207207
@update:model-value="handleLocaleChange"
208208
>
209209
<SelectTrigger
210-
class="h-9 w-[124px] gap-1 px-3"
210+
class="w-[116px] gap-1 px-2.5"
211211
:aria-label="t('switchLanguage')"
212212
:title="t('switchLanguage')"
213213
>
214-
<Languages class="h-4 w-4" />
214+
<Languages class="h-3.5 w-3.5" />
215215
<SelectValue />
216216
</SelectTrigger>
217217
<SelectContent>
@@ -229,12 +229,11 @@ const PropertyNode = defineComponent({
229229
variant="ghost"
230230
size="icon"
231231
data-testid="theme-toggle"
232-
class="h-9 w-9"
233232
:aria-label="isDark ? 'Switch to light theme' : 'Switch to dark theme'"
234233
@click="handleToggleTheme"
235234
>
236-
<Sun v-if="isDark" class="h-4 w-4" />
237-
<Moon v-else class="h-4 w-4" />
235+
<Sun v-if="isDark" class="h-3.5 w-3.5" />
236+
<Moon v-else class="h-3.5 w-3.5" />
238237
</Button>
239238
</div>
240239
</header>
@@ -248,7 +247,7 @@ const PropertyNode = defineComponent({
248247
{{ t('selection') }}
249248
</h2>
250249
</div>
251-
<Button variant="ghost" size="sm" class="h-7 px-2" @click="handleClearSelection">
250+
<Button variant="ghost" size="sm" @click="handleClearSelection">
252251
<Trash2 class="h-3.5 w-3.5" />
253252
<span>{{ t('removeBtn') }}</span>
254253
</Button>
@@ -276,7 +275,7 @@ const PropertyNode = defineComponent({
276275
v-if="slot.element"
277276
variant="ghost"
278277
size="icon"
279-
class="h-6 w-6 text-muted-foreground hover:text-foreground"
278+
class="text-muted-foreground hover:text-foreground"
280279
:aria-label="t('removeSelectedElement', slot.title)"
281280
:title="t('removeSelectedElement', slot.title)"
282281
@click="handleRemoveSelectedElement(slot.element.valueType)"
@@ -306,7 +305,7 @@ const PropertyNode = defineComponent({
306305
<Button
307306
variant="outline"
308307
size="sm"
309-
class="h-7 px-2 text-xs"
308+
class="text-xs"
310309
:aria-pressed="isAllProperty"
311310
@click="isAllProperty = !isAllProperty"
312311
>
@@ -318,14 +317,14 @@ const PropertyNode = defineComponent({
318317
<Search class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
319318
<Input
320319
v-model="inputValue"
321-
class="h-9 pl-9 pr-9"
320+
class="h-8 pl-9 pr-8"
322321
:placeholder="t('inputPlaceholder')"
323322
/>
324323
<Button
325324
v-if="inputValue"
326325
variant="ghost"
327326
size="icon"
328-
class="absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2"
327+
class="absolute right-0 top-1/2 -translate-y-1/2"
329328
aria-label="Clear filter"
330329
@click="inputValue = ''"
331330
>
@@ -357,10 +356,10 @@ const PropertyNode = defineComponent({
357356
</p>
358357
</div>
359358
<div class="flex items-center gap-2 text-xs text-muted-foreground">
360-
<span class="rounded-md border border-border px-2 py-1">
359+
<span class="flex h-8 items-center rounded-md border border-border px-2.5">
361360
{{ changedCount }} {{ t('changed') }}
362361
</span>
363-
<span class="rounded-md border border-border px-2 py-1">
362+
<span class="flex h-8 items-center rounded-md border border-border px-2.5">
364363
{{ totalCount }} {{ t('total') }}
365364
</span>
366365
</div>
@@ -399,7 +398,7 @@ const PropertyNode = defineComponent({
399398
<PopoverTrigger as-child>
400399
<button
401400
type="button"
402-
class="inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-background hover:text-foreground"
401+
class="inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition hover:bg-background hover:text-foreground"
403402
:aria-label="t('elementDetails')"
404403
>
405404
<Info class="h-3.5 w-3.5" />

tests/e2e/devtools-panel.spec.ts

Lines changed: 52 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,21 @@ test('renders the built DevTools panel shell', async ({ page }) => {
183183

184184
expect(statsBox.height).toBe(languageBox.height)
185185
expect(themeBox.height).toBe(languageBox.height)
186+
expect(languageBox.height).toBe(32)
187+
188+
const clearSelectionButton = page.getByRole('button', { name: 'Clear Selection' })
189+
const filterModeButton = page.getByRole('button', { name: 'Changed only' })
190+
const [clearSelectionBox, filterModeBox] = await Promise.all([
191+
clearSelectionButton.boundingBox(),
192+
filterModeButton.boundingBox(),
193+
])
194+
195+
if (!clearSelectionBox || !filterModeBox) {
196+
throw new Error('Expected page action control layout boxes to be available.')
197+
}
198+
199+
expect(clearSelectionBox.height).toBe(languageBox.height)
200+
expect(filterModeBox.height).toBe(languageBox.height)
186201
}
187202
finally {
188203
await server.close()
@@ -316,7 +331,16 @@ test('removes a single selected element from its selection card', async ({ page
316331
await expect(page.getByText('chat-input-anchor', { exact: true })).toBeVisible()
317332
await expect(page.getByRole('cell', { name: 'color' })).toBeVisible()
318333

319-
await page.getByRole('button', { name: 'Remove Target selection' }).click()
334+
const removeTargetButton = page.getByRole('button', { name: 'Remove Target selection' })
335+
const removeTargetBox = await removeTargetButton.boundingBox()
336+
337+
if (!removeTargetBox) {
338+
throw new Error('Expected remove target button layout box to be available.')
339+
}
340+
341+
expect(removeTargetBox.height).toBe(32)
342+
343+
await removeTargetButton.click()
320344

321345
await expect(page.getByText('chat-input-background', { exact: true })).toBeVisible()
322346
await expect(page.getByText('chat-input-anchor', { exact: true })).not.toBeVisible()
@@ -345,7 +369,16 @@ test('removes a single selected element from its selection card', async ({ page
345369
.forEach(callback => callback(selected))
346370
})
347371

348-
await page.getByRole('button', { name: 'Remove Source selection' }).click()
372+
const removeSourceButton = page.getByRole('button', { name: 'Remove Source selection' })
373+
const removeSourceBox = await removeSourceButton.boundingBox()
374+
375+
if (!removeSourceBox) {
376+
throw new Error('Expected remove source button layout box to be available.')
377+
}
378+
379+
expect(removeSourceBox.height).toBe(32)
380+
381+
await removeSourceButton.click()
349382

350383
await expect(page.getByText('chat-input-background', { exact: true })).not.toBeVisible()
351384
await expect(page.getByText('chat-input-anchor', { exact: true })).toBeVisible()
@@ -443,7 +476,23 @@ test('filters property names without adding visual spacing inside the match', as
443476
.forEach(callback => callback(selected))
444477
})
445478

446-
await page.getByPlaceholder('Please enter the css property you want to view').fill('alig')
479+
const filterInput = page.getByPlaceholder('Please enter the css property you want to view')
480+
const filterInputBox = await filterInput.boundingBox()
481+
482+
if (!filterInputBox) {
483+
throw new Error('Expected filter input layout box to be available.')
484+
}
485+
486+
expect(filterInputBox.height).toBe(32)
487+
488+
await filterInput.fill('alig')
489+
const clearFilterBox = await page.getByRole('button', { name: 'Clear filter' }).boundingBox()
490+
491+
if (!clearFilterBox) {
492+
throw new Error('Expected clear filter button layout box to be available.')
493+
}
494+
495+
expect(clearFilterBox.height).toBe(32)
447496

448497
const propertyCell = page.getByRole('cell', { name: 'align-items' })
449498

0 commit comments

Comments
 (0)