[+] Implement tag directions

This commit is contained in:
Hykilpikonna
2021-12-26 17:29:28 -05:00
parent 3009173e79
commit f7da695a49
2 changed files with 29 additions and 9 deletions
+2 -2
View File
@@ -78,10 +78,10 @@ export default class BlogPostPreview extends Vue
> * + * > * + *
margin-top: 10px margin-top: 10px
.tag .tags
font-size: 0.7em font-size: 0.7em
.tag + .tag .tag-wrap + .tag-wrap
margin-left: 5px margin-left: 5px
#titles #titles
+27 -7
View File
@@ -1,16 +1,20 @@
<template> <template>
<div class="tag fbox-vcenter"> <div class="tag-wrap">
<slot></slot> <div class="tag fbox-vcenter" :class="direction">
<div class="after"></div> <slot></slot>
<div class="after"></div>
</div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import {Options, Vue} from 'vue-class-component'; import {Options, Vue} from 'vue-class-component';
import {Prop} from "vue-property-decorator";
@Options({components: {}}) @Options({components: {}})
export default class Tag extends Vue export default class Tag extends Vue
{ {
@Prop({default: 'left'}) direction: 'left' | 'right' = 'left'
} }
</script> </script>
@@ -24,15 +28,15 @@ $text-color: $color-text-light
$padding: $tag-height / 2 $padding: $tag-height / 2
$triangle-width: $tag-height / 2 * 0.8 $triangle-width: $tag-height / 2 * 0.8
.tag-wrap
display: inline-block
.tag .tag
background: $tag-color background: $tag-color
border-radius: 3px 0 0 3px
color: $text-color color: $text-color
display: inline-flex display: inline-flex
height: $tag-height height: $tag-height
padding: 0 ($padding - 4) 0 $padding
position: relative position: relative
margin-right: $triangle-width
transition: color 0.2s transition: color 0.2s
.after .after
@@ -40,6 +44,22 @@ $triangle-width: $tag-height / 2 * 0.8
border-top: $tag-height / 2 solid transparent border-top: $tag-height / 2 solid transparent
border-left: $triangle-width solid $tag-color border-left: $triangle-width solid $tag-color
position: absolute position: absolute
right: -$triangle-width
top: 0 top: 0
.tag.right
padding: 0 ($padding - 4) 0 $padding
margin-right: $triangle-width
border-radius: 3px 0 0 3px
.after
right: -$triangle-width
.tag.left
padding: 0 $padding 0 ($padding - 4)
margin-left: $triangle-width
border-radius: 0 3px 3px 0
.after
transform: rotate(180deg)
left: -$triangle-width
</style> </style>