mirror of
https://github.com/bitinflow/ui.git
synced 2026-03-13 13:45:59 +00:00
Add support for href and darkmode toggle
This commit is contained in:
47
src/runtime/components/BitinflowFirstLevelHref.vue
Normal file
47
src/runtime/components/BitinflowFirstLevelHref.vue
Normal 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>
|
||||||
@@ -122,6 +122,12 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Avatar
|
Avatar
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
darkMode: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
count: 0,
|
count: 0,
|
||||||
@@ -155,6 +161,7 @@ export default {
|
|||||||
this.$refs.sidebar.classList.add('-translate-x-full');
|
this.$refs.sidebar.classList.add('-translate-x-full');
|
||||||
},
|
},
|
||||||
toggleDarkMode() {
|
toggleDarkMode() {
|
||||||
|
if (!this.darkMode) return;
|
||||||
this.count++;
|
this.count++;
|
||||||
if (this.count % 4 === 0) {
|
if (this.count % 4 === 0) {
|
||||||
console.log('rotate');
|
console.log('rotate');
|
||||||
|
|||||||
Reference in New Issue
Block a user