style: tighten header and locale selector

This commit is contained in:
shake 2026-06-22 16:49:57 +08:00
parent 8a9d5fd303
commit 28eb27a718
5 changed files with 23 additions and 46 deletions

View file

@ -13,10 +13,15 @@ const theme = computed(() => (styleStore.isDarkTheme ? darkTheme : null));
const themeOverrides = computed(() => (styleStore.isDarkTheme ? darkThemeOverrides : lightThemeOverrides));
const { locale } = useI18n();
const localeStorage = useStorage('locale', 'zh');
if (!['zh', 'en'].includes(localeStorage.value)) {
localeStorage.value = 'zh';
}
syncRef(
locale,
useStorage('locale', locale),
localeStorage,
);
</script>

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { IconBrandGithub, IconBrandX, IconInfoCircle } from '@tabler/icons-vue';
import { IconBrandGithub, IconInfoCircle } from '@tabler/icons-vue';
</script>
<template>
@ -9,32 +9,18 @@ import { IconBrandGithub, IconBrandX, IconInfoCircle } from '@tabler/icons-vue';
circle
size="small"
variant="text"
href="https://github.com/CorentinTh/it-tools"
href="https://github.com/shake/it-tools"
target="_blank"
rel="noopener noreferrer"
:aria-label="$t('home.nav.githubRepository')"
>
<n-icon size="22" :component="IconBrandGithub" />
</c-button>
</c-tooltip>
<c-tooltip :tooltip="$t('home.nav.twitterX')" position="bottom">
<c-button
circle
size="small"
variant="text"
href="https://x.com/ittoolsdottech"
rel="noopener"
target="_blank"
:aria-label="$t('home.nav.twitterXAccount')"
>
<n-icon size="22" :component="IconBrandX" />
<n-icon size="20" :component="IconBrandGithub" />
</c-button>
</c-tooltip>
<c-tooltip :tooltip="$t('home.nav.about')" position="bottom">
<c-button circle size="small" variant="text" to="/about" :aria-label="$t('home.nav.aboutLabel')">
<n-icon size="22" :component="IconInfoCircle" />
<n-icon size="20" :component="IconInfoCircle" />
</c-button>
</c-tooltip>
</div>
@ -44,5 +30,6 @@ import { IconBrandGithub, IconBrandX, IconInfoCircle } from '@tabler/icons-vue';
.navbar-buttons {
display: flex;
align-items: center;
gap: 4px;
}
</style>

View file

@ -96,18 +96,18 @@ const tools = computed<ToolCategory[]>(() => [
:aria-label="$t('home.toggleMenu')"
@click="styleStore.isMenuCollapsed = !styleStore.isMenuCollapsed"
>
<NIcon size="25" :component="Menu2" />
<NIcon size="22" :component="Menu2" />
</c-button>
<c-tooltip :tooltip="$t('home.home')" position="bottom">
<c-button to="/" circle variant="text" :aria-label="$t('home.home')">
<NIcon size="25" :component="Home2" />
<NIcon size="22" :component="Home2" />
</c-button>
</c-tooltip>
<c-tooltip :tooltip="$t('home.uiLib')" position="bottom">
<c-button v-if="config.app.env === 'development'" to="/c-lib" circle variant="text" :aria-label="$t('home.uiLib')">
<icon-mdi:brush-variant text-20px />
<icon-mdi:brush-variant text-18px />
</c-button>
</c-tooltip>
@ -189,6 +189,6 @@ const tools = computed<ToolCategory[]>(() => [
}
.top-right-actions {
gap: 6px;
gap: 4px;
}
</style>

View file

@ -1,32 +1,17 @@
<script setup lang="ts">
const { availableLocales, locale } = useI18n();
const { locale } = useI18n();
const localesLong: Record<string, string> = {
en: 'English',
de: 'Deutsch',
es: 'Español',
fr: 'Français',
no: 'Norwegian',
pt: 'Português',
ru: 'Русский',
uk: 'Українська',
zh: '中文',
vi: 'Tiếng Việt',
};
const localeOptions = computed(() =>
availableLocales.map(locale => ({
label: localesLong[locale] ?? locale,
value: locale,
})),
);
const localeOptions = [
{ label: '中文', value: 'zh' },
{ label: 'English', value: 'en' },
];
</script>
<template>
<c-select
v-model:value="locale"
:options="localeOptions"
placeholder="Select a language"
w-100px
size="small"
w-88px
/>
</template>

View file

@ -5,7 +5,7 @@ import { createI18n } from 'vue-i18n';
const i18n = createI18n({
legacy: false,
locale: 'en',
locale: 'zh',
messages,
});