feat: add button component

This commit is contained in:
Sebin Nyshkim 2022-01-07 16:15:42 +01:00
parent 72f2c6d748
commit 28bb7711d9
3 changed files with 83 additions and 2 deletions

52
src/components/Button.vue Normal file
View file

@ -0,0 +1,52 @@
<template>
<a
class="btn"
:href="href"
:download="href.slice(href.lastIndexOf('/') + 1)"
v-if="download"
>
<slot></slot>
</a>
<a class="btn" :href="href" v-else> <slot></slot> </a>
</template>
<script>
export default {
props: {
href: String,
download: Boolean,
},
};
</script>
<style lang="scss">
@import "@/scss/_variables.scss";
.btn {
margin: 0.5em 0;
padding: 0.5em 1em;
position: relative;
top: 0;
border-radius: 0.25em;
box-shadow: 0 0.5em 0 0 $bg-color-dark;
transition: all 0.1s ease-out;
background-color: lighten($bg-color-dark, 5%);
text-decoration: none;
text-align: center;
&:hover {
top: -0.25em;
box-shadow: 0 0.75em 0 0 $bg-color-dark;
}
&:active {
top: 0.25em;
box-shadow: 0 0.25em 0 0 $bg-color-dark;
}
}
</style>

View file

@ -14,7 +14,8 @@
h2, h2,
h3, h3,
p, p,
.quickfacts { .quickfacts,
.btn-group {
max-width: 55rem; max-width: 55rem;
margin: { margin: {
left: 1rem; left: 1rem;

View file

@ -10,15 +10,43 @@
Want to learn more about this handsome dragon? You've come to the right Want to learn more about this handsome dragon? You've come to the right
place! place!
</p> </p>
<p>
Or if you just want to download the complete ref sheet you can do so here:
</p>
<div class="btn-group flex flex--row flex--wrap">
<btn href="/sebin-ref-full-SFW-hires.jpg">Download SFW (10 MB)</btn>
<btn href="/sebin-ref-full-NSFW-hires.jpg">Download NSFW (10,2 MB)</btn>
</div>
</prose> </prose>
</template> </template>
<script> <script>
import Prose from "@/components/Prose.vue"; import Prose from "@/components/Prose.vue";
import Welcome from "@/components/Welcome.vue"; import Welcome from "@/components/Welcome.vue";
import btn from "@/components/Button.vue";
export default { export default {
name: "Home", name: "Home",
components: { Prose, Welcome }, components: { Prose, Welcome, btn },
}; };
</script> </script>
<style lang="scss">
@import "@/scss/base.scss";
.btn-group {
justify-content: space-evenly;
.btn {
flex: 1 0 100%;
margin: 1em 0;
@include mq-desktop {
flex: 0 0 auto;
}
}
}
</style>