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

View File

@ -25,7 +25,7 @@ function calculateValue(value: any){
</script> </script>
<template> <template>
<div <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" v-if="props.cardItem?.items && props.cardItem?.items?.length > 0"
> >
<div class="text-base mb-3 text-main">{{ props.cardItem?.title }}</div> <div class="text-base mb-3 text-main">{{ props.cardItem?.title }}</div>

View File

@ -1,7 +1,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { getLogo, useDashboard, } from '@/stores/useDashboard'; import { getLogo, useDashboard } from '@/stores/useDashboard';
import { computed } from 'vue'; import { computed } from 'vue';
import { Icon } from '@iconify/vue' import { Icon } from '@iconify/vue';
const props = defineProps({ const props = defineProps({
name: { name: {
@ -10,27 +10,40 @@ const props = defineProps({
}, },
}); });
const dashboardStore = useDashboard() const dashboardStore = useDashboard();
const conf = computed(() => dashboardStore.chains[props.name] || {}) const conf = computed(() => dashboardStore.chains[props.name] || {});
const addFavor = (e: Event) => { const addFavor = (e: Event) => {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
dashboardStore.favoriteMap[props.name] = !dashboardStore?.favoriteMap?.[props.name]; dashboardStore.favoriteMap[props.name] =
window.localStorage.setItem('favoriteMap', JSON.stringify(dashboardStore.favoriteMap)) !dashboardStore?.favoriteMap?.[props.name];
} window.localStorage.setItem(
'favoriteMap',
JSON.stringify(dashboardStore.favoriteMap)
);
};
</script> </script>
<template> <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"> <div class="w-8 h-8 rounded-full overflow-hidden">
<img :src="conf.logo" /> <img :src="conf.logo" />
</div> </div>
<div class="font-semibold ml-4 text-base flex-1"> <div class="font-semibold ml-4 text-base flex-1">
{{ conf?.prettyName || props.name }} {{ conf?.prettyName || props.name }}
</div> </div>
<div @click="addFavor" class="pl-4 text-xl" <div
:class="{ 'text-warning': dashboardStore?.favoriteMap?.[props.name], 'text-gray-300 dark:text-gray-500': !dashboardStore?.favoriteMap?.[props.name] }"> @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" /> <Icon icon="mdi-star" />
</div> </div>
</RouterLink> </RouterLink>

View File

@ -14,7 +14,7 @@ onMounted(() => {
<template> <template>
<div class="overflow-hidden"> <div class="overflow-hidden">
<!-- Chain ID --> <!-- Chain ID -->
<div class="bg-card px-4 pt-3 pb-4 rounded"> <div class="bg-base-100 px-4 pt-3 pb-4 rounded">
<div class="text-base mb-3 text-main">{{ chain.title }}</div> <div class="text-base mb-3 text-main">{{ chain.title }}</div>
<div <div
class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 2xl:grid-cols-6 gap-4" class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 2xl:grid-cols-6 gap-4"
@ -40,13 +40,13 @@ onMounted(() => {
<!-- Slashing Parameters --> <!-- Slashing Parameters -->
<CardParameter :cardItem="store.slashing"/> <CardParameter :cardItem="store.slashing"/>
<!-- Application Version --> <!-- Application Version -->
<div class="bg-card px-4 pt-3 pb-4 rounded-sm mt-6"> <div class="bg-base-100 px-4 pt-3 pb-4 rounded-sm mt-6">
<div class="text-base mb-3 text-main">{{ store.appVersion?.title }}</div> <div class="text-base mb-3 text-main">{{ store.appVersion?.title }}</div>
<ArrayObjectElement :value="store.appVersion?.items" :thead="false"/> <ArrayObjectElement :value="store.appVersion?.items" :thead="false"/>
</div> </div>
<!-- Node Information --> <!-- Node Information -->
<div class="bg-card px-4 pt-3 pb-4ß rounded-sm mt-6"> <div class="bg-base-100 px-4 pt-3 pb-4ß rounded-sm mt-6">
<div class="text-base mb-3 text-main">{{ store.nodeVersion?.title }}</div> <div class="text-base mb-3 text-main">{{ store.nodeVersion?.title }}</div>
<ArrayObjectElement :value="store.nodeVersion?.items" :thead="false"/> <ArrayObjectElement :value="store.nodeVersion?.items" :thead="false"/>
</div> </div>

View File

@ -1,24 +1,29 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useDashboard, LoadingStatus, type ChainConfig } from '@/stores/useDashboard'; import {
useDashboard,
LoadingStatus,
type ChainConfig,
} from '@/stores/useDashboard';
import ChainSummary from '@/components/ChainSummary.vue'; import ChainSummary from '@/components/ChainSummary.vue';
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useBlockchain } from '@/stores'; import { useBlockchain } from '@/stores';
const dashboard = useDashboard() const dashboard = useDashboard();
dashboard.$subscribe((mutation, state) => { dashboard.$subscribe((mutation, state) => {
localStorage.setItem('favorite', JSON.stringify(state.favorite)) localStorage.setItem('favorite', JSON.stringify(state.favorite));
}) });
const keywords = ref('') const keywords = ref('');
const chains = computed(() => { const chains = computed(() => {
if (keywords.value) { if (keywords.value) {
return Object.values(dashboard.chains).filter((x: ChainConfig) => x.chainName.indexOf(keywords.value) > -1) return Object.values(dashboard.chains).filter(
(x: ChainConfig) => x.chainName.indexOf(keywords.value) > -1
);
} else { } else {
return Object.values(dashboard.chains) return Object.values(dashboard.chains);
} }
}) });
const chain = useBlockchain() const chain = useBlockchain();
</script> </script>
<template> <template>
<div class=""> <div class="">
@ -29,29 +34,43 @@ const chain = useBlockchain()
<h1 class="text-primary text-3xl md:text-6xl font-bold mr-2"> <h1 class="text-primary text-3xl md:text-6xl font-bold mr-2">
Ping dashboard Ping dashboard
</h1> </h1>
<div class="badge badge-info badge-outline mt-1 text-sm md:mt-8">Beta</div> <div class="badge badge-info badge-outline mt-1 text-sm md:mt-8">
Beta
</div>
</div> </div>
<div class="text-center text-base"> <div class="text-center text-base">
<p class="mb-1"> <p class="mb-1">
{{ $t('index.slogan') }} {{ $t('index.slogan') }}
</p> </p>
<h2 class="mb-6"> <h2 class="mb-6">Cosmos Ecosystem Blockchains 🚀</h2>
Cosmos Ecosystem Blockchains 🚀 </div>
</h2> <div
v-if="dashboard.status !== LoadingStatus.Loaded"
class="flex justify-center"
>
<progress class="progress progress-info w-80 h-1"></progress>
</div> </div>
<div v-if="dashboard.status !== LoadingStatus.Loaded" class="flex justify-center"><progress
class="progress progress-info w-80 h-1"></progress></div>
<VTextField v-model="keywords" variant="underlined" :placeholder="$t('index.search_placeholder')" <VTextField
style="max-width: 300px;" app> v-model="keywords"
variant="underlined"
:placeholder="$t('index.search_placeholder')"
style="max-width: 300px"
app
>
<template #append-inner> <template #append-inner>
{{ chains.length }}/{{ dashboard.length }} {{ chains.length }}/{{ dashboard.length }}
</template> </template>
</VTextField> </VTextField>
<div class="grid grid-cols-2 gap-4 mt-6 md:grid-cols-3 lg:grid-cols-4 2xl:grid-cols-5"> <div
<ChainSummary v-for="(chain, index) in chains" :key="index" :name="chain.chainName" /> class="grid grid-cols-2 gap-4 mt-6 md:grid-cols-3 lg:grid-cols-4 2xl:grid-cols-5"
>
<ChainSummary
v-for="(chain, index) in chains"
:key="index"
:name="chain.chainName"
/>
</div> </div>
</div> </div>
</template> </template>

View File

@ -22,13 +22,13 @@ watch(locale, (val) => {
document.documentElement.setAttribute('lang', val as string); document.documentElement.setAttribute('lang', val as string);
}); });
const currentLang = ref([localStorage.getItem('lang') || 'en']); const currentLang = ref(localStorage.getItem('lang') || 'en');
</script> </script>
<template> <template>
<div class="dropdown dropdown-end"> <div class="dropdown dropdown-end">
<label tabindex="0" class="btn btn-ghost btn-circle btn-sm mx-1"> <label tabindex="0" class="btn btn-ghost btn-circle btn-sm mx-1">
<Icon icon="mdi-translate" style="font-size: 24px" /> <Icon icon="mdi-translate" class="text-2xl" />
</label> </label>
<ul <ul
tabindex="0" tabindex="0"
@ -36,6 +36,8 @@ const currentLang = ref([localStorage.getItem('lang') || 'en']);
> >
<li v-for="lang in props.languages" :key="lang.i18nLang"> <li v-for="lang in props.languages" :key="lang.i18nLang">
<a <a
class="hover:bg-base-content"
:class="{ 'text-primary': currentLang === lang.i18nLang }"
@click=" @click="
locale = lang.i18nLang; locale = lang.i18nLang;
$emit('change', lang.i18nLang); $emit('change', lang.i18nLang);

View File

@ -6,16 +6,12 @@
:root { :root {
--text-main: #333; --text-main: #333;
--text-secondary: #4b525d; --text-secondary: #4b525d;
--bg-card: #fff;
--bg-active: #fbfbfc; --bg-active: #fbfbfc;
--bg-hover: #eee;
} }
html.dark { html.dark {
--text-main: #f7f7f7; --text-main: #f7f7f7;
--text-secondary: #6f6e84; --text-secondary: #6f6e84;
--bg-card: #28334e;
--bg-active: #242b40; --bg-active: #242b40;
--bg-hover: #303044;
} }
} }

View File

@ -11,34 +11,28 @@ module.exports = {
primary: '#666cff', primary: '#666cff',
main: 'var(--text-main)', main: 'var(--text-main)',
secondary: 'var(--text-secondary)', secondary: 'var(--text-secondary)',
card: 'var(--bg-card)',
hover: 'var(--bg-hover)',
active: 'var(--bg-active)', active: 'var(--bg-active)',
}, },
}, },
}, },
plugins: [ plugins: [require('daisyui')],
require("daisyui")
],
daisyui: { daisyui: {
themes: [ themes: [
{
myTheme: {
info: "#666CFF",
}
},
{ {
light: { light: {
...require("daisyui/src/colors/themes")["[data-theme=light]"], ...require('daisyui/src/colors/themes')['[data-theme=light]'],
info: "#666CFF", info: '#666CFF',
} 'base-content': '#e9eaeb'
},
}, },
{ {
dark: { dark: {
...require("daisyui/src/colors/themes")["[data-theme=dark]"], ...require('daisyui/src/colors/themes')['[data-theme=dark]'],
info: "#666CFF", info: '#666CFF',
} 'base-100': '#2a334c',
'base-content': '#373f57'
},
}, },
], ],
} },
}; };