Skip to content

Commit 7d8f620

Browse files
committed
feat: enhance Tag component with closeable functionality and improved visibility
1 parent c1d1d71 commit 7d8f620

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

frontend/src/components/Modal/index.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ provide('submit', handleSubmit)
133133
<div class="ml-auto">
134134
<slot name="toolbar"></slot>
135135
<!-- <Button v-if="toolbar.minimize" @click="toggleMinimize" icon="minimize" type="text" /> -->
136-
<Button
137-
v-if="toolbar.maximize"
138-
@click="toggleMaximize"
139-
:class="isMaximize ? '' : 'rotate-180'"
140-
icon="arrowDown"
141-
type="text"
142-
/>
136+
<Button v-if="toolbar.maximize" @click="toggleMaximize" type="text">
137+
<Icon
138+
:class="{ maximize: isMaximize }"
139+
icon="arrowDown"
140+
class="origin-center duration-200"
141+
/>
142+
</Button>
143143
</div>
144144
</div>
145145
<div class="flex-1 overflow-auto mx-16">
@@ -190,4 +190,8 @@ provide('submit', handleSubmit)
190190
background-color: var(--modal-bg);
191191
}
192192
}
193+
194+
.maximize {
195+
transform: rotate(-180deg);
196+
}
193197
</style>

frontend/src/components/Tag/index.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
11
<script setup lang="ts">
2+
import { ref } from 'vue'
3+
24
interface Props {
35
color?: 'cyan' | 'green' | 'red' | 'default' | 'primary'
46
size?: 'small' | 'default'
7+
closeable?: boolean
58
}
69
710
withDefaults(defineProps<Props>(), {
811
color: 'default',
12+
closable: false,
913
})
14+
15+
const emit = defineEmits(['close'])
16+
17+
const show = ref(true)
18+
const handleClose = () => {
19+
emit('close')
20+
show.value = false
21+
}
1022
</script>
1123

1224
<template>
1325
<div
26+
v-if="show"
1427
:class="[color, size]"
15-
class="gui-tag px-8 mx-4 rounded-6 inline-block text-12 white-space-nowrap"
28+
class="gui-tag px-8 mx-4 rounded-6 inline-block text-12 white-space-nowrap inline-flex items-center"
1629
>
1730
<slot></slot>
31+
<Icon
32+
v-if="closeable"
33+
@click="handleClose"
34+
:size="size === 'small' ? 12 : 14"
35+
icon="close"
36+
class="ml-2"
37+
/>
1838
</div>
1939
</template>
2040

0 commit comments

Comments
 (0)