feat: bg-base-100 bg-base-cotent

This commit is contained in:
Alisa | Side.one
2023-05-05 08:37:12 +08:00
parent d39b4caf16
commit 51c173e82d
7 changed files with 84 additions and 60 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ function calculateValue(value: any){
</script>
<template>
<div
class="bg-card px-4 pt-3 pb-4 rounded mt-5"
class="bg-base-100 px-4 pt-3 pb-4 rounded mt-5"
v-if="props.cardItem?.items && props.cardItem?.items?.length > 0"
>
<div class="text-base mb-3 text-main">{{ props.cardItem?.title }}</div>
+25 -12
View File
@@ -1,7 +1,7 @@
<script lang="ts" setup>
import { getLogo, useDashboard, } from '@/stores/useDashboard';
import { getLogo, useDashboard } from '@/stores/useDashboard';
import { computed } from 'vue';
import { Icon } from '@iconify/vue'
import { Icon } from '@iconify/vue';
const props = defineProps({
name: {
@@ -10,28 +10,41 @@ const props = defineProps({
},
});
const dashboardStore = useDashboard()
const conf = computed(() => dashboardStore.chains[props.name] || {})
const dashboardStore = useDashboard();
const conf = computed(() => dashboardStore.chains[props.name] || {});
const addFavor = (e: Event) => {
e.stopPropagation();
e.preventDefault();
dashboardStore.favoriteMap[props.name] = !dashboardStore?.favoriteMap?.[props.name];
window.localStorage.setItem('favoriteMap', JSON.stringify(dashboardStore.favoriteMap))
}
dashboardStore.favoriteMap[props.name] =
!dashboardStore?.favoriteMap?.[props.name];
window.localStorage.setItem(
'favoriteMap',
JSON.stringify(dashboardStore.favoriteMap)
);
};
</script>
<template>
<RouterLink :to="`/${name}`" class="bg-base-100 rounded shadow flex items-center px-3 py-3 cursor-pointer">
<RouterLink
:to="`/${name}`"
class="bg-base-100 hover:bg-base-content rounded shadow flex items-center px-3 py-3 cursor-pointer"
>
<div class="w-8 h-8 rounded-full overflow-hidden">
<img :src="conf.logo" />
</div>
<div class="font-semibold ml-4 text-base flex-1">
{{ conf?.prettyName || props.name }}
</div>
<div @click="addFavor" class="pl-4 text-xl"
:class="{ 'text-warning': dashboardStore?.favoriteMap?.[props.name], 'text-gray-300 dark:text-gray-500': !dashboardStore?.favoriteMap?.[props.name] }">
<div
@click="addFavor"
class="pl-4 text-xl"
:class="{
'text-warning': dashboardStore?.favoriteMap?.[props.name],
'text-gray-300 dark:text-gray-500':
!dashboardStore?.favoriteMap?.[props.name],
}"
>
<Icon icon="mdi-star" />
</div>
</RouterLink>
</template>
</template>