feat: update button component

This commit is contained in:
Sebin Nyshkim 2022-01-07 21:26:32 +01:00
parent 818e0d7f49
commit 3bc6fc630f
2 changed files with 64 additions and 58 deletions

View file

@ -5,7 +5,7 @@
:class="{ 'figure__border--polaroid': polaroidBorder }" :class="{ 'figure__border--polaroid': polaroidBorder }"
> >
<template v-if="!nsfw || $root.nsfw"> <template v-if="!nsfw || $root.nsfw">
<slot name="img"></slot> <div class="figure__image"><slot name="img"></slot></div>
</template> </template>
<template v-else> <template v-else>
@ -15,25 +15,22 @@
<div class="hazard-tape"></div> <div class="hazard-tape"></div>
<div class="hazard-tape"></div> <div class="hazard-tape"></div>
<p>🔥 Here be spicy dragons 🌶</p> <div class="figure__reveal">
<p>🔥 Here be spicy dragons 🌶</p>
<nsfw-switch <nsfw-switch
:id="id" :id="id"
v-model="$root.nsfw" v-model="$root.nsfw"
@change="$root.showWarning()" @change="$root.showWarning()"
/> />
</div>
</div> </div>
</template> </template>
<figcaption class="figure__meta"> <figcaption class="figure__meta">
<template v-if="!nsfw || $root.nsfw"> <template v-if="!nsfw || $root.nsfw">
<div class="caption"> <div class="caption"><slot name="caption"></slot></div>
<slot name="caption"></slot> <div class="copyright">© <slot name="copyright"></slot></div>
</div>
<div class="copyright">
<slot name="copyright"></slot>
</div>
</template> </template>
<template v-else> <template v-else>
@ -66,6 +63,7 @@ export default {
.figure { .figure {
display: flex; display: flex;
flex-flow: row nowrap; flex-flow: row nowrap;
justify-content: center;
margin: 1em auto; margin: 1em auto;
padding: 0 1em; padding: 0 1em;
@ -81,10 +79,12 @@ export default {
&--polaroid { &--polaroid {
margin: 1em auto; margin: 1em auto;
padding: 1em; padding: 1em;
background-color: #fff;
box-shadow: inset 0 0 1em rgba(#000, 0.7), 0 0 1em rgba(#000, 0.7); box-shadow: inset 0 0 1em rgba(#000, 0.7), 0 0 1em rgba(#000, 0.7);
border-radius: 0.325em; border-radius: 0.325em;
background-color: #fff;
.figure__meta { .figure__meta {
margin: 0.5em 0; margin: 0.5em 0;
font-family: "Permanent Marker", fantasy; font-family: "Permanent Marker", fantasy;
@ -97,14 +97,40 @@ export default {
} }
} }
&__image {
flex: 1 0 auto;
img {
max-width: 100%;
max-height: 35em;
}
}
&__meta {
flex: 0 0 auto;
}
&__cencor { &__cencor {
flex: 1 0 auto;
display: flex;
flex-flow: row wrap;
justify-content: center;
align-items: center;
padding: 0;
width: 50vw;
height: 35vh;
max-width: 35em;
max-height: 70em;
position: relative; position: relative;
padding: 6em 0;
background-color: $bg-color-light; background-color: $bg-color-light;
overflow: hidden; overflow: hidden;
@include mq-desktop { @include mq-desktop {
padding: 9em 7em; width: 20em;
height: 20em;
} }
.figure__border & .nsfw-switch { .figure__border & .nsfw-switch {
@ -128,12 +154,12 @@ export default {
); );
&:nth-child(1) { &:nth-child(1) {
top: 5%; top: 10%;
transform: rotate(5deg); transform: rotate(5deg);
} }
&:nth-child(2) { &:nth-child(2) {
top: 10%; top: 15%;
transform: rotate(-10deg); transform: rotate(-10deg);
} }
@ -144,23 +170,9 @@ export default {
&:nth-child(4) { &:nth-child(4) {
top: 85%; top: 85%;
transform: translate(-3em, -2em) rotate(40deg); transform: translate(-5em, -2em) rotate(40deg);
} }
} }
} }
img {
max-width: 100%;
object-fit: contain;
@include mq-desktop {
max-height: 60vh;
}
}
a:before {
display: inline;
content: "©";
}
} }
</style> </style>

View file

@ -99,13 +99,21 @@ export default {
} }
&__prev { &__prev {
left: 1em; left: 1.5em;
transform: rotate(-135deg); transform: rotate(-135deg);
@include mq-desktop {
left: 2em;
}
} }
&__next { &__next {
right: 1em; right: 1.5em;
transform: rotate(45deg); transform: rotate(45deg);
@include mq-desktop {
right: 2em;
}
} }
&__images { &__images {
@ -122,32 +130,18 @@ export default {
height: 100%; height: 100%;
transition: 0.3s all ease-in-out; transition: 0.3s all ease-in-out;
}
figure { .figure {
flex: 0 0 100%; margin: 0;
padding: 0 3em;
flex: 1 0 100%;
display: flex; @include mq-desktop {
flex-flow: column nowrap; padding: 0 3.5em;
justify-content: center;
width: 100vw;
height: 100%;
margin: 0;
padding: 0 2em;
@include mq-desktop {
padding: 0 2.5em;
}
} }
picture { &__meta {
flex: 0 1 auto;
text-align: center;
max-height: 80%;
}
figcaption {
flex: 0 0 100%;
text-align: center; text-align: center;
p { p {