Skip to content

Commit 0767036

Browse files
hi-ogawacodex
andauthored
refactor(ui): consolidate unocss style to use class (#11206)
Co-authored-by: Hiroshi Ogawa <4232207+hi-ogawa@users.noreply.github.com> Co-authored-by: Codex (GPT-6) <noreply@openai.com>
1 parent 23dda73 commit 0767036

36 files changed

Lines changed: 235 additions & 456 deletions

‎packages/ui/client/components/BrowserIframe.vue‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,18 @@ const scale = computed(() =>
5858
</script>
5959

6060
<template>
61-
<div id="browser-frame" h="full" flex="~ col">
62-
<div p="3" h-10 flex="~ gap-2" items-center bg-header border="b base">
61+
<div id="browser-frame" class="h-full flex flex-col">
62+
<div class="p-3 h-10 flex gap-2 items-center bg-header border-b border-base">
6363
<IconButton
6464
v-show="panels.navigation <= 15"
6565
v-tooltip.bottom="'Show Navigation Panel'"
6666
title="Show Navigation Panel"
67-
rotate-180
67+
class="rotate-180"
6868
icon="i-carbon:side-panel-close"
6969
@click="showNavigationPanel()"
7070
/>
7171
<div class="i-carbon-content-delivery-network" />
72-
<span pl-1 font-bold text-sm flex-auto ws-nowrap overflow-hidden truncate>Browser UI</span>
72+
<span class="pl-1 font-bold text-sm flex-auto ws-nowrap overflow-hidden truncate">Browser UI</span>
7373
<IconButton
7474
v-show="detailsPosition === 'right' && !detailsPanelVisible"
7575
v-tooltip.bottom="'Show Details Panel'"
@@ -78,7 +78,7 @@ const scale = computed(() =>
7878
@click="detailsPanelVisible = true"
7979
/>
8080
</div>
81-
<div p="l3 y2 r2" flex="~ gap-2" items-center bg-header border="b-2 base">
81+
<div class="pl-3 py-2 pr-2 flex gap-2 items-center bg-header border-base border-b-2">
8282
<!-- TODO: these are only for preview (thank you Storybook!), we need to support more different and custom sizes (as a dropdown) -->
8383
<IconButton
8484
v-tooltip.bottom="'Small mobile'"
@@ -101,7 +101,7 @@ const scale = computed(() =>
101101
:active="isViewport('tablet')"
102102
@click="changeViewport('tablet')"
103103
/>
104-
<span class="pointer-events-none" text-sm>
104+
<span class="pointer-events-none text-sm">
105105
{{ viewport[0] }}x{{ viewport[1] }}px
106106
<span v-if="scale < 100">({{ scale }}%)</span>
107107
</span>

‎packages/ui/client/components/ClosedDetailsHeader.vue‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ import DetailsHeaderButtons from '~/components/DetailsHeaderButtons.vue'
44

55
<template>
66
<div
7-
p="2"
8-
flex="~ gap-2"
9-
items-center
10-
bg-header
11-
border="b base"
7+
class="p-2 flex gap-2 items-center bg-header border-b border-base"
128
>
13-
<div flex-1 />
9+
<div class="flex-1" />
1410
<DetailsHeaderButtons />
1511
</div>
1612
</template>

‎packages/ui/client/components/CodeMirrorContainer.vue‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ onMounted(async () => {
7171

7272
<template>
7373
<div
74-
relative
75-
font-mono
76-
text-sm
77-
class="codemirror-scrolls"
74+
class="codemirror-scrolls relative font-mono text-sm"
7875
:class="{
7976
'codemirror-busy': saving,
8077
'codemirror-hide-cursor': readOnly,

‎packages/ui/client/components/ConnectionOverlay.vue‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,25 @@ import {
1010
<template>
1111
<template v-if="!isConnected">
1212
<div
13-
fixed
14-
inset-0
15-
p2
16-
z-10
17-
select-none
18-
text="center sm"
19-
bg="overlay"
20-
backdrop-blur-sm
21-
backdrop-saturate-0
13+
class="fixed inset-0 p2 z-10 select-none text-center text-sm bg-overlay backdrop-blur-sm backdrop-saturate-0"
2214
@click="client.reconnect"
2315
>
2416
<div
25-
h-full
26-
flex="~ col gap-2"
27-
items-center
28-
justify-center
17+
class="h-full flex flex-col gap-2 items-center justify-center"
2918
:class="isConnecting ? 'animate-pulse' : ''"
3019
>
3120
<div
32-
text="5xl"
21+
class="text-5xl"
3322
:class="
3423
isConnecting
3524
? 'i-carbon:renew animate-spin animate-reverse'
3625
: 'i-carbon-wifi-off'
3726
"
3827
/>
39-
<div text-2xl>
28+
<div class="text-2xl">
4029
{{ isConnecting ? "Connecting..." : "Disconnected" }}
4130
</div>
42-
<div text-lg op50>
31+
<div class="text-lg op50">
4332
Check your terminal or start a new server with `{{
4433
browserState
4534
? `vitest --browser=${browserState.config.browser.name}`

‎packages/ui/client/components/Coverage.vue‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { browserState } from '~/composables/client'
44
</script>
55

66
<template>
7-
<div h="full" flex="~ col">
8-
<div p="3" h-10 flex="~ gap-2" items-center bg-header border="b base">
7+
<div class="h-full flex flex-col">
8+
<div class="p-3 h-10 flex gap-2 items-center bg-header border-b border-base">
99
<div class="i-carbon:folder-details-reference" />
10-
<span pl-1 font-bold text-sm flex-auto ws-nowrap overflow-hidden truncate>Coverage</span>
10+
<span class="pl-1 font-bold text-sm flex-auto ws-nowrap overflow-hidden truncate">Coverage</span>
1111
<DetailsHeaderButtons v-if="browserState" />
1212
</div>
13-
<div flex-auto py-1 bg-white>
13+
<div class="flex-auto py-1 bg-white">
1414
<iframe id="vitest-ui-coverage" src="./coverage/index.html" />
1515
</div>
1616
</div>

‎packages/ui/client/components/Dashboard.vue‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import TestsFilesContainer from './dashboard/TestsFilesContainer.vue'
55
</script>
66

77
<template>
8-
<div h="full" flex="~ col">
9-
<div p="3" h-10 flex="~ gap-2" items-center bg-header border="b base">
8+
<div class="h-full flex flex-col">
9+
<div class="p-3 h-10 flex gap-2 items-center bg-header border-b border-base">
1010
<div class="i-carbon-dashboard" />
11-
<span pl-1 font-bold text-sm flex-auto ws-nowrap overflow-hidden truncate>Dashboard</span>
11+
<span class="pl-1 font-bold text-sm flex-auto ws-nowrap overflow-hidden truncate">Dashboard</span>
1212
<DetailsHeaderButtons v-if="browserState" />
1313
</div>
14-
<div class="scrolls" flex-auto py-1>
14+
<div class="scrolls flex-auto py-1">
1515
<TestsFilesContainer />
1616
</div>
1717
</div>

‎packages/ui/client/components/FailureScreenshot.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function openScreenshot() {
4040

4141
<template>
4242
<template v-if="screenshotUrl">
43-
<div flex="~ gap-2 items-center">
43+
<div class="flex gap-2 items-center">
4444
<IconButton
4545
v-tooltip.bottom="'View screenshot error'"
4646
class="!op-100"

‎packages/ui/client/components/FileDetails.vue‎

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -95,41 +95,33 @@ const tags = computed(() => {
9595
<template>
9696
<div
9797
v-if="current"
98-
flex
99-
flex-col
100-
h-full
101-
max-h-full
102-
overflow-hidden
98+
class="flex flex-col h-full max-h-full overflow-hidden"
10399
data-testid="file-detail"
104100
>
105101
<div>
106-
<div p="2" h-10 flex="~ gap-2" items-center bg-header border="b base">
102+
<div class="p-2 h-10 flex gap-2 items-center bg-header border-b border-base">
107103
<StatusIcon :state="current.result?.state" :mode="current.mode" :failed-snapshot="failedSnapshot" />
108-
<div v-if="isTypecheck" v-tooltip.bottom="'This is a typecheck test. It won\'t report results of the runtime tests'" class="i-logos:typescript-icon" flex-shrink-0 />
109-
<span v-if="label" class="rounded-sm px-1 text-xs font-light bg-cyan-500/20 text-cyan-700 dark:text-cyan-300" flex-shrink-0>{{ label }}</span>
104+
<div v-if="isTypecheck" v-tooltip.bottom="'This is a typecheck test. It won\'t report results of the runtime tests'" class="i-logos:typescript-icon flex-shrink-0" />
105+
<span v-if="label" class="rounded-sm px-1 text-xs font-light bg-cyan-500/20 text-cyan-700 dark:text-cyan-300 flex-shrink-0">{{ label }}</span>
110106
<span
111107
v-if="current?.file.projectName"
112-
class="rounded-full py-0.5 px-2 text-xs font-light"
108+
class="rounded-full py-0.5 px-2 text-xs font-light cursor-default"
113109
:style="projectBadgeStyle"
114-
cursor-default
115110
>
116111
{{ current.file.projectName }}
117112
</span>
118-
<div flex-1 font-light overflow-hidden text-sm flex>
119-
<span op-50 truncate>
113+
<div class="flex-1 font-light overflow-hidden text-sm flex">
114+
<span class="op-50 truncate">
120115
{{ testTitle }}
121116
</span>
122117

123118
<span
124119
v-for="tag of tags"
125120
:key="tag.name"
126121
v-tooltip.bottom="tag.description"
127-
class="rounded-full ml-2 px-2 text-xs font-light"
122+
class="rounded-full ml-2 px-2 text-xs font-light cursor-default flex items-center"
128123
:style="{ backgroundColor: tag.bg, color: tag.text, border: `1px solid ${tag.border}` }"
129124
:title="tag.description"
130-
cursor-default
131-
flex
132-
items-center
133125
>
134126
{{ tag.name }}
135127
</span>
@@ -146,10 +138,9 @@ const tags = computed(() => {
146138
<DetailsHeaderButtons v-if="browserState" />
147139
</div>
148140
</div>
149-
<div flex="~" items-center bg-header border="b-2 base" text-sm h-41px>
141+
<div class="flex items-center bg-header border-base border-b-2 text-sm h-41px">
150142
<button
151-
tab-button
152-
class="flex items-center gap-2"
143+
class="flex items-center gap-2 tab-button"
153144
:class="{ 'tab-button-active': viewMode == null }"
154145
data-testid="btn-report"
155146
@click="changeViewMode(null)"
@@ -158,29 +149,26 @@ const tags = computed(() => {
158149
Report
159150
</button>
160151
<button
161-
tab-button
162152
data-testid="btn-graph"
163-
class="flex items-center gap-2"
153+
class="flex items-center gap-2 tab-button"
164154
:class="{ 'tab-button-active': viewMode === 'graph' }"
165155
@click="changeViewMode('graph')"
166156
>
167157
<span class="block w-1.4em h-1.4em i-carbon:chart-relationship" />
168158
Module Graph
169159
</button>
170160
<button
171-
tab-button
172161
data-testid="btn-code"
173-
class="flex items-center gap-2"
162+
class="flex items-center gap-2 tab-button"
174163
:class="{ 'tab-button-active': viewMode === 'editor' }"
175164
@click="changeViewMode('editor')"
176165
>
177166
<span class="block w-1.4em h-1.4em i-carbon:code" />
178167
{{ draft ? "*&#160;" : "" }}Code
179168
</button>
180169
<button
181-
tab-button
182170
data-testid="btn-console"
183-
class="flex items-center gap-2"
171+
class="flex items-center gap-2 tab-button"
184172
:class="{
185173
'tab-button-active': viewMode === 'console',
186174
'op20': viewMode !== 'console' && consoleCount === 0,
@@ -193,7 +181,7 @@ const tags = computed(() => {
193181
</div>
194182
</div>
195183

196-
<div flex flex-col flex-1 overflow="hidden">
184+
<div class="flex flex-col flex-1 overflow-hidden">
197185
<FileDetailsModuleGraph
198186
v-if="viewMode === 'graph'"
199187
:key="`graph:${current.id}`"

‎packages/ui/client/components/FileDetailsModuleGraph.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ const graph = computed(() => {
4040
</script>
4141

4242
<template>
43-
<div flex-1 overflow-hidden>
44-
<div v-if="isLoading" h-full flex items-center justify-center op-70>
43+
<div class="flex-1 overflow-hidden">
44+
<div v-if="isLoading" class="h-full flex items-center justify-center op-70">
4545
Loading module graph...
4646
</div>
4747
<ViewModuleGraph

‎packages/ui/client/components/FilterStatus.vue‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,16 @@ function toggle() {
2525
:class="[
2626
modelValue ? 'i-carbon:checkbox-checked-filled' : 'i-carbon:checkbox',
2727
]"
28-
text-lg
29-
flex-shrink-0
28+
class="text-lg flex-shrink-0"
3029
aria-hidden="true"
3130
/>
3231
<input
3332
v-model="modelValue"
3433
type="checkbox"
3534
:disabled="disabled"
36-
sr-only
35+
class="sr-only"
3736
>
38-
<span flex-1 ms-2 select-none whitespace-nowrap truncate>{{ label }}</span>
37+
<span class="flex-1 ms-2 select-none whitespace-nowrap truncate">{{ label }}</span>
3938
</label>
4039
</template>
4140

0 commit comments

Comments
 (0)