Skip to content

Commit 5b05aa5

Browse files
committed
Refactor UI components for improved styling and consistency
1 parent e860cb7 commit 5b05aa5

File tree

37 files changed

+255
-407
lines changed

37 files changed

+255
-407
lines changed

frontend/src/assets/styles/theme.less

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888

8989
// Menu
9090
--menu-bg: ~'var(--menu-bg-@{theme})';
91-
--menu-item-hover: ~'var(--menu-item-hover-@{theme})';
9291

9392
// Table
9493
--table-tr-odd-bg: ~'var(--table-tr-odd-bg-@{theme})';

frontend/src/assets/styles/utilities/display.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,7 @@
2929
.\!hidden {
3030
display: none !important;
3131
}
32+
33+
.invisible {
34+
visibility: hidden;
35+
}

frontend/src/assets/styles/utilities/flex.less

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
.justify-evenly {
5454
justify-content: space-evenly;
5555
}
56-
56+
.shrink-0 {
57+
flex-shrink: 0;
58+
}
5759
.flex-1 {
5860
flex: 1 1 0%;
5961
}

frontend/src/assets/styles/utilities/others.less

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
z-index: 999;
3939
}
4040

41+
.z-9999 {
42+
z-index: 9999;
43+
}
44+
4145
.top-0 {
4246
top: 0;
4347
}
@@ -102,6 +106,10 @@
102106
cursor: pointer;
103107
}
104108

109+
.pointer-events-none {
110+
pointer-events: none;
111+
}
112+
105113
.overflow-auto {
106114
overflow: auto;
107115
}
@@ -118,10 +126,34 @@
118126
transition-property: all;
119127
}
120128

129+
.duration-100 {
130+
transition-duration: 0.1s;
131+
}
132+
121133
.duration-200 {
122134
transition-duration: 0.2s;
123135
}
124136

125137
.duration-400 {
126138
transition-duration: 0.4s;
127139
}
140+
141+
.shadow {
142+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
143+
}
144+
145+
.outline-none {
146+
outline: none;
147+
}
148+
149+
.border-0 {
150+
border: none;
151+
}
152+
153+
.bg-transparent {
154+
background: transparent;
155+
}
156+
157+
.border-collapse {
158+
border-collapse: collapse;
159+
}

frontend/src/assets/styles/utilities/rounded.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@radius-values: 0, 2, 4, 8, 16, 32, 9999;
1+
@radius-values: 0, 2, 4, 6, 8, 16, 32, 9999;
22

33
.generate-rounded(@i: 1) when (@i <= length(@radius-values)) {
44
@r: extract(@radius-values, @i);

frontend/src/assets/styles/utilities/size.less

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@size-values: 0, 8, 12, 16, 24, 32, 64, 128, 256;
1+
@size-values: 0, 8, 10, 12, 16, 18, 24, 32, 64, 128, 256;
22
@percent-values: 25, 50, 60, 75, 90, 100;
33

44
.generate-size(@i: 1) when (@i <= length(@size-values)) {
@@ -27,6 +27,18 @@
2727
.h-\[@{p}\%\] {
2828
height: ~'@{p}%';
2929
}
30+
.min-w-\[@{p}\%\] {
31+
min-width: ~'@{p}%';
32+
}
33+
.min-h-\[@{p}\%\] {
34+
min-height: ~'@{p}%';
35+
}
36+
.max-w-\[@{p}\%\] {
37+
max-width: ~'@{p}%';
38+
}
39+
.max-h-\[@{p}\%\] {
40+
max-height: ~'@{p}%';
41+
}
3042
.generate-percent(@i + 1);
3143
}
3244
.generate-percent();

frontend/src/assets/styles/utilities/text.less

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
.text-right {
1919
text-align: right;
2020
}
21+
.align-middle {
22+
vertical-align: middle;
23+
}
2124

2225
.line-clamp-1 {
2326
display: -webkit-box;
@@ -43,6 +46,30 @@
4346
text-wrap: nowrap;
4447
}
4548

49+
.text-ellipsis {
50+
text-overflow: ellipsis;
51+
}
52+
53+
.break-all {
54+
word-break: break-all;
55+
}
56+
57+
.break-keep {
58+
word-break: keep-all;
59+
}
60+
61+
.whitespace-nowrap {
62+
white-space: nowrap;
63+
}
64+
65+
.whitespace-pre-wrap {
66+
white-space: pre-wrap;
67+
}
68+
69+
.leading-relaxed {
70+
line-height: 1.625;
71+
}
72+
4673
.font-bold {
4774
font-weight: bold;
4875
}

frontend/src/assets/styles/variables.less

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@
100100
--progress-inner-bg-dark: var(--primary-color);
101101

102102
// Dropdown
103-
--dropdown-bg-light: #fff;
104-
--dropdown-bg-dark: #343434;
103+
--dropdown-bg-light: rgba(255, 255, 255, 0.8);
104+
--dropdown-bg-dark: rgba(62, 62, 62, 0.8);
105105

106106
// Modal
107107
--modal-bg-light: #f6f6f6;
@@ -143,10 +143,8 @@
143143
--toast-bg-dark: #343434;
144144

145145
// Menu
146-
--menu-bg-light: #fff;
147-
--menu-item-hover-light: #e9e9e9;
148-
--menu-bg-dark: rgba(52, 52, 52, 1);
149-
--menu-item-hover-dark: rgb(91, 91, 91);
146+
--menu-bg-light: rgba(255, 255, 255, 0.8);
147+
--menu-bg-dark: rgba(62, 62, 62, 0.8);
150148

151149
// Table
152150
--table-tr-odd-bg-light: rgb(247, 247, 247);

frontend/src/components/Button/index.vue

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,18 @@ withDefaults(defineProps<Props>(), {
2020
</script>
2121

2222
<template>
23-
<div :class="[type, size, { disabled, loading }]" class="btn">
23+
<div
24+
:class="[type, size, { 'pointer-events-none': disabled || loading }]"
25+
class="gui-button inline-flex items-center justify-center text-center align-middle rounded-6 text-14 cursor-pointer px-12 py-6 duration-200"
26+
>
2427
<Icon v-if="loading" :fill="`var(--btn-${type}-color)`" icon="loading" class="rotation" />
2528
<template v-else>
26-
<Icon v-if="disabled" :fill="`var(--btn-${type}-color)`" icon="forbidden" class="disabled" />
29+
<Icon
30+
v-if="disabled"
31+
:fill="`var(--btn-${type}-color)`"
32+
icon="forbidden"
33+
class="pointer-events-none"
34+
/>
2735
<Icon
2836
v-if="icon"
2937
:icon="icon"
@@ -37,24 +45,6 @@ withDefaults(defineProps<Props>(), {
3745
</template>
3846

3947
<style lang="less" scoped>
40-
.btn {
41-
display: inline-flex;
42-
align-items: center;
43-
justify-content: center;
44-
text-align: center;
45-
vertical-align: middle;
46-
border-radius: 6px;
47-
font-size: 14px;
48-
cursor: pointer;
49-
padding: 6px 12px;
50-
transition: all 0.2s;
51-
}
52-
53-
.disabled,
54-
.loading {
55-
pointer-events: none;
56-
}
57-
5848
.normal {
5949
color: var(--btn-normal-color);
6050
background-color: var(--btn-normal-bg);

frontend/src/components/Card/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const hasTitle = computed(() => {
2020
</script>
2121

2222
<template>
23-
<div class="card rounded-8 relative flex flex-col">
23+
<div class="gui-card rounded-8 relative flex flex-col">
2424
<div v-if="hasTitle" class="card-header flex items-center p-8">
2525
<slot name="title-prefix"></slot>
2626
<div v-if="title" v-tips="title" class="card-header_title line-clamp-1 text-16 font-bold">
@@ -53,7 +53,7 @@ const hasTitle = computed(() => {
5353
</template>
5454

5555
<style lang="less" scoped>
56-
.card {
56+
.gui-card {
5757
color: var(--card-color);
5858
background-color: var(--card-bg);
5959
transition:

0 commit comments

Comments
 (0)