Add support for href and darkmode toggle

This commit is contained in:
René Preuß
2023-04-13 21:36:37 +02:00
parent 56bd212ab6
commit 583aeacf37
2 changed files with 54 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
<template>
<a
class="hover:bg-primary-500 rounded-lg text-center text-xs py-4 flex flex-col space-y-2"
:class="calculateClasses"
:href="href"
>
<i :class="['fal text-xl', icon]" />
<span>
<slot />
</span>
</a>
</template>
<script>
export default {
name: "BitinflowFirstLevelLink",
props: {
icon: {
type: String,
default: 'fa-arrow-up-right-from-square'
},
href: {
type: String,
default: '/'
}
},
computed: {
calculateClasses: function () {
return {
'router-link-active': document.location.href.includes(this.href) && this.href !== '/',
}
}
}
}
</script>
<style scoped>
.router-link-active {
@apply bg-primary-500 dark:bg-primary-500;
}
/*
.router-link-active:hover {
@apply bg-primary-600 dark:bg-primary-400;
}
*/
</style>

View File

@@ -122,6 +122,12 @@ export default {
components: {
Avatar
},
props: {
darkMode: {
type: Boolean,
default: false
}
},
data() {
return {
count: 0,
@@ -155,6 +161,7 @@ export default {
this.$refs.sidebar.classList.add('-translate-x-full');
},
toggleDarkMode() {
if (!this.darkMode) return;
this.count++;
if (this.count % 4 === 0) {
console.log('rotate');