Skip to content

Commit 5cfdf73

Browse files
committed
perf: update table style
1 parent 0d191a4 commit 5cfdf73

7 files changed

Lines changed: 50 additions & 120 deletions

File tree

README_PACK.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

preview.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

ui/app.config.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ export default defineAppConfig({
6666
dropdownMenu: {
6767
slots: {
6868
content: "w-(--reka-dropdown-menu-trigger-width) p-1",
69-
item: "mx-0.5 px-3 py-2 rounded-md transition-colors duration-150 data-[state=open]:bg-primary/10 data-[state=checked]:bg-primary/10",
70-
itemLabel:
71-
"group-data-[state=checked]:text-primary group-data-highlighted:text-primary group-data-[state=open]:text-primary",
72-
itemLeadingIcon:
73-
"group-data-[state=checked]:text-primary group-data-highlighted:!text-primary group-data-[state=open]:!text-primary",
74-
itemTrailingIcon:
75-
"group-data-[state=checked]:text-primary group-data-highlighted:text-primary group-data-[state=open]:text-primary"
69+
item: "mx-0.5 px-3 py-2 rounded-md transition-colors duration-150",
7670
}
7771
},
7872
navigationMenu: {

ui/assets/css/main.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
:root {
1414
--ui-color-primary-500: #1ab394;
1515
--ui-color-elevated-500: #303237;
16-
--ui-color-secondary-500: #141419;
17-
--ui-color-neutral-100: #d1d1d1;
16+
--ui-color-secondary-500: #7e7e7e;
17+
--ui-color-neutral-100: #d8d8d8;
1818
--el-font-family: var(--font-sans);
1919
--bg-hover-light: rgba(60, 60, 60, 0.1);
2020
--bg-hover-dark: rgba(0, 0, 0, 0.3);

ui/components/Card/TableCard/tableCard.vue

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
22
import type { AssetItem } from "~/types";
33
import type { TableColumn } from "@nuxt/ui";
4+
import { UCheckbox, UButton } from "#components";
45
import { h, resolveComponent } from "vue";
56
67
interface MenuItem {
@@ -160,6 +161,25 @@ function cancelRename() {
160161
}
161162
162163
const columns: TableColumn<AssetItem>[] = [
164+
{
165+
id: 'select',
166+
header: ({ table }) =>
167+
h(UCheckbox, {
168+
modelValue: table.getIsSomePageRowsSelected()
169+
? 'indeterminate'
170+
: table.getIsAllPageRowsSelected(),
171+
'onUpdate:modelValue': (value: boolean | 'indeterminate') =>
172+
table.toggleAllPageRowsSelected(!!value),
173+
'aria-label': 'Select all'
174+
}),
175+
cell: ({ row }) =>
176+
h(UCheckbox, {
177+
modelValue: row.getIsSelected(),
178+
'onUpdate:modelValue': (value: boolean | 'indeterminate') => row.toggleSelected(!!value),
179+
'aria-label': 'Select row'
180+
}),
181+
meta: { class: { th: "w-[50px]", td: "w-[50px]" } }
182+
},
163183
{
164184
accessorKey: "assetName",
165185
header: () => t("AssetCard.AssetName"),
@@ -191,7 +211,7 @@ const columns: TableColumn<AssetItem>[] = [
191211
row.original.name
192212
);
193213
},
194-
meta: { class: { th: "w-1/5", td: "w-1/5" } }
214+
meta: { class: { th: "max-w-[300px]", td: "max-w-[300px]" } }
195215
},
196216
{
197217
accessorKey: "address",
@@ -205,7 +225,7 @@ const columns: TableColumn<AssetItem>[] = [
205225
},
206226
row.original.address
207227
),
208-
meta: { class: { th: "w-1/5", td: "w-1/5" } }
228+
meta: { class: { th: "max-w-[300px]", td: "max-w-[300px]" } }
209229
},
210230
{
211231
id: "user",
@@ -221,23 +241,27 @@ const columns: TableColumn<AssetItem>[] = [
221241
userText
222242
);
223243
},
224-
meta: { class: { th: "w-1/5", td: "w-1/5" } }
244+
meta: { class: { th: "w-[250px]", td: "w-[250px]" } }
225245
},
226246
{
227247
id: "protocol",
228248
header: () => t("AssetCard.Protocol"),
229249
cell: ({ row }) => {
230250
const protocolText = displayProtocol(row.original.id, row.original.permedProtocols!);
231-
return h(
232-
"div",
233-
{
234-
class: "truncate",
235-
title: protocolText
236-
},
251+
if (!protocolText || protocolText === "-") {
252+
return h("div", { class: "truncate" }, "-");
253+
}
254+
const color = {
255+
paid: 'success' as const,
256+
failed: 'error' as const,
257+
refunded: 'neutral' as const
258+
}[row.getValue('status') as string]
259+
260+
return h(UButton, { size: 'xs', class: 'rounded-sm', variant: 'subtle', color: 'primary' }, () =>
237261
protocolText
238-
);
262+
)
239263
},
240-
meta: { class: { th: "w-1/5", td: "w-1/5" } }
264+
meta: { class: { th: "w-[150px]", td: "w-[150px]" } }
241265
},
242266
{
243267
id: "actions",
@@ -248,14 +272,15 @@ const columns: TableColumn<AssetItem>[] = [
248272
return h(
249273
UFieldGroup,
250274
{
251-
size: "sm",
252-
class: "inline-flex rounded-md shadow-sm"
275+
size: "xs",
276+
class: "inline-flex rounded-sm text-right"
253277
},
254278
{
255279
default: () => [
256280
h(UButton, {
257281
color: "primary",
258282
variant: "outline",
283+
class: "rounded-sm",
259284
label: t("Common.Connect"),
260285
onClick: () => emits("connectAsset", row.original)
261286
}),
@@ -275,6 +300,7 @@ const columns: TableColumn<AssetItem>[] = [
275300
icon: "i-lucide-ellipsis",
276301
color: "primary",
277302
variant: "outline",
303+
class: "rounded-sm",
278304
"data-table-context-button": true
279305
})
280306
}
@@ -283,7 +309,7 @@ const columns: TableColumn<AssetItem>[] = [
283309
}
284310
);
285311
},
286-
meta: { class: { th: "w-1/5", td: "w-1/5" } }
312+
meta: { class: { th: "w-[260px] text-center", td: "w-[260px] text-center" } }
287313
}
288314
];
289315
</script>
@@ -302,11 +328,11 @@ const columns: TableColumn<AssetItem>[] = [
302328
:data="props.items"
303329
:columns="columns"
304330
:empty="t('Common.NoData')"
305-
class="w-full table-fixed"
331+
class="w-full table-auto"
306332
:ui="{
307-
tr: 'hover:bg-muted/50',
333+
tr: 'hover:bg-muted/50 ',
308334
th: 'whitespace-nowrap text-xs sm:text-sm',
309-
td: 'whitespace-nowrap text-xs sm:text-sm'
335+
td: 'whitespace-nowrap text-xs sm:text-sm py-2'
310336
}"
311337
></UTable>
312338
</div>

ui/components/EditForm/editForm.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ function handleSpecialAccount(v: string) {
129129
trailingIcon
130130
}"
131131
icon="mingcute:plugin-line"
132-
variant="subtle"
133132
class="w-full"
134133
/>
135134
</UFormField>
@@ -142,7 +141,6 @@ function handleSpecialAccount(v: string) {
142141
trailingIcon
143142
}"
144143
icon="lucide:user-round"
145-
variant="subtle"
146144
class="w-full"
147145
/>
148146
</UFormField>

ui/components/Modal/modal.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ withDefaults(
44
open: boolean;
55
title?: string;
66
description?: string;
7+
overlay?: boolean;
78
}>(),
89
{
910
title: "",
10-
description: ""
11+
description: "",
12+
overlay: false
1113
}
1214
);
1315
@@ -52,6 +54,7 @@ const handleContextMenu = async (e: Event) => {
5254
:ui="{ footer: 'justify-end', description: 'text-xs-plus' }"
5355
:description="description"
5456
:title="title"
57+
:overlay="overlay"
5558
@update:open="updateOpen"
5659
>
5760
<template #body>

0 commit comments

Comments
 (0)