summaryrefslogtreecommitdiff
path: root/src/client/app/common/views/components/ui/button.vue
blob: e7787503546d74d53d34a62c3fabd62151c096d3 (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
82
<template>
<div class="ui-button" :class="[styl]">
	<button :type="type" @click="$emit('click')">
		<slot></slot>
	</button>
</div>
</template>

<script lang="ts">
import Vue from 'vue';
export default Vue.extend({
	props: {
		type: {
			type: String,
			required: false
		}
	},
	data() {
		return {
			styl: 'fill'
		};
	},
	inject: {
		isCardChild: { default: false }
	},
	created() {
		if (this.isCardChild) {
			this.styl = 'line';
		}
	}
});
</script>

<style lang="stylus" scoped>
@import '~const.styl'

root(isDark, fill)
	> button
		display block
		width 100%
		margin 0
		padding 0
		font-weight bold
		font-size 16px
		line-height 44px
		border none
		border-radius 6px
		outline none
		box-shadow none

		if fill
			color $theme-color-foreground
			background $theme-color

			&:hover
				background lighten($theme-color, 5%)

			&:active
				background darken($theme-color, 5%)
		else
			color $theme-color
			background none

			&:hover
				color darken($theme-color, 5%)

			&:active
				background rgba($theme-color, 0.3)

.ui-button[data-darkmode]
	&.fill
		root(true, true)
	&:not(.fill)
		root(true, false)

.ui-button:not([data-darkmode])
	&.fill
		root(false, true)
	&:not(.fill)
		root(false, false)

</style>