fix: Dashboard directories will now use their icon

This commit is contained in:
jamesread 2025-12-25 01:29:38 +00:00
parent e49db63dad
commit 9256b5c756
1 changed files with 38 additions and 1 deletions

View File

@ -1,11 +1,13 @@
<template> <template>
<button @click="navigateToDirectory"> <button @click="navigateToDirectory">
{{ component.title }} <span class="icon" v-html="unicodeIcon"></span>
<span class="title">{{ component.title }}</span>
</button> </button>
</template> </template>
<script setup> <script setup>
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { computed } from 'vue'
const router = useRouter() const router = useRouter()
@ -16,6 +18,18 @@ const props = defineProps({
} }
}) })
function getUnicodeIcon(icon) {
if (icon === '' || !icon) {
return '&#x1f4c1;' // Default folder icon
} else {
return unescape(icon)
}
}
const unicodeIcon = computed(() => {
return getUnicodeIcon(props.component.icon)
})
function navigateToDirectory() { function navigateToDirectory() {
const params = { title: props.component.title } const params = { title: props.component.title }
@ -34,9 +48,18 @@ function navigateToDirectory() {
} }
button { button {
display: flex;
flex-direction: column;
flex-grow: 1;
justify-content: center;
padding: 0.5em;
box-shadow: 0 0 .6em #aaa; box-shadow: 0 0 .6em #aaa;
background-color: #fff; background-color: #fff;
border-radius: .7em; border-radius: .7em;
border: 1px solid #ccc;
cursor: pointer;
transition: all 0.2s ease;
font-size: .85em;
} }
button:hover { button:hover {
@ -44,16 +67,30 @@ button:hover {
border-color: #999; border-color: #999;
} }
button .icon {
font-size: 3em;
flex-grow: 1;
align-content: center;
}
button .title {
font-weight: 500;
padding: 0.2em;
}
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
button { button {
box-shadow: 0 0 .6em #000; box-shadow: 0 0 .6em #000;
background-color: #111; background-color: #111;
border-color: #000; border-color: #000;
color: #fff;
} }
button:hover { button:hover {
background-color: #222; background-color: #222;
border-color: #000; border-color: #000;
box-shadow: 0 0 6px #444;
color: #fff;
} }
} }