summaryrefslogtreecommitdiff
path: root/src/client/components/form/button.vue
blob: b4f0890945e7f81d049471561b72285014391976 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
<div class="yzpgjkxe _formItem">
	<div class="_formLabel"><slot name="label"></slot></div>
	<button class="main _button _formPanel _formClickable" :class="{ center, primary, danger }">
		<slot></slot>
		<div class="suffix">
			<slot name="suffix"></slot>
			<div class="icon">
				<slot name="suffixIcon"></slot>
			</div>
		</div>
	</button>
	<div class="_formCaption"><slot name="desc"></slot></div>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import './form.scss';

export default defineComponent({
	props: {
		primary: {
			type: Boolean,
			required: false,
			default: false,
		},
		danger: {
			type: Boolean,
			required: false,
			default: false,
		},
		disabled: {
			type: Boolean,
			required: false,
			default: false,
		},
		center: {
			type: Boolean,
			required: false,
			default: true,
		}
	},
});
</script>

<style lang="scss" scoped>
.yzpgjkxe {
	> .main {
		display: flex;
		width: 100%;
		box-sizing: border-box;
		padding: 14px 16px;
		text-align: left;
		align-items: center;

		&.center {
			display: block;
			text-align: center;
		}

		&.primary {
			color: var(--accent);
		}

		&.danger {
			color: #ff2a2a;
		}

		> .suffix {
			display: inline-flex;
			margin-left: auto;
			opacity: 0.7;

			> .icon {
				margin-left: 1em;
			}
		}
	}
}
</style>