add DotButton hover text pos

This commit is contained in:
axolotle
2021-06-30 12:53:54 +02:00
parent a4b0f6e2f2
commit f53bae6541
2 changed files with 24 additions and 4 deletions
+15 -3
View File
@@ -11,7 +11,7 @@
@blur="show = false" @blur="show = false"
@click="onClick" @click="onClick"
> >
<span> <span :class="pos">
<slot name="default" /> <slot name="default" />
</span> </span>
</b-button> </b-button>
@@ -25,7 +25,8 @@ export default {
variant: { type: String, required: true }, variant: { type: String, required: true },
active: { type: Boolean, default: false }, active: { type: Boolean, default: false },
hovered: { type: Boolean, default: false }, hovered: { type: Boolean, default: false },
dotOnly: { type: Boolean, default: false } dotOnly: { type: Boolean, default: false },
pos: { type: String, default: 'left' }
}, },
data () { data () {
@@ -74,10 +75,21 @@ export default {
pointer-events: none; pointer-events: none;
position: absolute; position: absolute;
display: block; display: block;
transform: translate(calc(-100% + 1.1875rem), -50%);
border-radius: 50rem; border-radius: 50rem;
padding: 0 $input-btn-padding-x; padding: 0 $input-btn-padding-x;
line-height: 1.5; line-height: 1.5;
&.left {
transform: translate(calc(-100% + 1.1875rem), -50%);
}
&.right {
transform: translate(-2px, -50%);
}
&.middle {
transform: translate(calc(-50% + #{1.1875rem / 2}), -50%);
}
} }
@each $color, $value in $theme-colors { @each $color, $value in $theme-colors {
+9 -1
View File
@@ -2,7 +2,7 @@
<nav class="node-view-child-list" :class="{ 'smartphone': smartphone }"> <nav class="node-view-child-list" :class="{ 'smartphone': smartphone }">
<ul> <ul>
<li <li
v-for="child in children" :key="child.id" v-for="(child, i) in children" :key="child.id"
class="node-view-child-list-item" class="node-view-child-list-item"
> >
<dot-button <dot-button
@@ -10,6 +10,7 @@
:variant="child.variant" :variant="child.variant"
:active="activeNodes.includes(child.id)" :active="activeNodes.includes(child.id)"
dot-only dot-only
:pos="smartphone ? getDir(i) : 'left'"
> >
{{ $t('variants.' + child.variant) }} {{ $t('variants.' + child.variant) }}
</dot-button> </dot-button>
@@ -40,6 +41,13 @@ export default {
}, },
methods: { methods: {
getDir (index) {
const len = this.children.length
if (index === 0) return 'right'
if (index === this.children.length - 1) return 'left'
return 'middle'
},
onOpen (childId) { onOpen (childId) {
this.$emit('open-child', { childId }) this.$emit('open-child', { childId })
} }