/
FoldButton.vue
59 lines (51 loc) · 1.22 KB
/
FoldButton.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<template>
<button :class="$style.button" :data-background="background">
<a-icon
v-if="showIcon"
:name="isFold ? 'down' : 'up'"
:class="$style['icon']"
/>
{{ isFold ? 'さらに表示' : '折りたたむ' }}
</button>
</template>
<script setup lang="ts">
import type { ButtonHTMLAttributes } from 'vue'
import AIcon from '/@/components/UI/AIcon.vue'
interface Props extends /* @vue-ignore */ ButtonHTMLAttributes {
showIcon?: boolean
background?: 'primary' | 'secondary' | 'tertiary'
isFold: boolean
}
withDefaults(defineProps<Props>(), {
showIcon: false,
background: 'tertiary'
})
</script>
<style lang="scss" module>
.button {
cursor: pointer;
display: flex;
gap: 4px;
align-items: center;
font-weight: bold;
border-radius: 4px;
padding: 0 24px;
min-height: 24px;
font-size: 12px;
line-height: 1.5;
width: fit-content;
color: $theme-text-primary-default;
&[data-background='primary'] {
background-color: $theme-ui-primary-default;
}
&[data-background='secondary'] {
background-color: $theme-ui-secondary-default;
}
&[data-background='tertiary'] {
background-color: $theme-ui-tertiary-default;
}
.icon {
margin-left: -12px;
}
}
</style>