add DotButton component

This commit is contained in:
axolotle
2021-05-23 21:43:17 +02:00
parent 1405617850
commit 5fcb01d3a6
2 changed files with 120 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
<template>
<b-button
class="dot-btn"
:class="['dot-btn-' + variant, { 'active': active, 'show': show }]"
v-bind="$attrs" v-on="$listeners"
:active="active"
:variant="variant"
@mouseover="show = true"
@mouseleave="show = false"
@focus="show = true"
@blur="show = false"
@click="onClick"
>
<span>
<slot name="default" />
</span>
</b-button>
</template>
<script>
export default {
name: 'DotButton',
props: {
variant: { type: String, required: true },
active: { type: Boolean, default: false }
},
data () {
return {
show: false
}
},
methods: {
onClick (e) {
this.$el.blur()
}
}
}
</script>
<style lang="scss" scoped>
@each $color, $value in $theme-colors {
.dot-btn-#{$color} {
@include dot-button-variant($value, $value);
}
}
.dot-btn {
word-break: keep-all;
white-space: pre;
&:not(.show) {
min-height: 1.1875rem;
min-width: 1.1875rem;
padding: 0;
&.dot-btn-depart {
min-height: 1.875rem;
min-width: 1.875rem;
}
span {
display: none;
}
}
}
</style>