mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-07-25 16:19:38 +02:00
refactor(home): improved landing page ui
This commit is contained in:
parent
274ff02b54
commit
0bd8fabb85
10 changed files with 353 additions and 114 deletions
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { NIcon, useThemeVars, type MenuGroupOption } from 'naive-ui';
|
||||
import { h } from 'vue';
|
||||
import { computed, h } from 'vue';
|
||||
import { RouterLink, useRoute } from 'vue-router';
|
||||
import { Heart, Menu2, Home2 } from '@vicons/tabler';
|
||||
import { toolsByCategory } from '@/tools';
|
||||
|
@ -8,6 +8,7 @@ import { useStyleStore } from '@/stores/style.store';
|
|||
import { config } from '@/config';
|
||||
import MenuIconItem from '@/components/MenuIconItem.vue';
|
||||
import type { Tool } from '@/tools/tools.types';
|
||||
import { useToolStore } from '@/tools/tools.store';
|
||||
import SearchBar from '../components/SearchBar.vue';
|
||||
import HeroGradient from '../assets/hero-gradient.svg?component';
|
||||
import MenuLayout from '../components/MenuLayout.vue';
|
||||
|
@ -22,16 +23,25 @@ const commitSha = config.app.lastCommitSha.slice(0, 7);
|
|||
const makeLabel = (tool: Tool) => () => h(RouterLink, { to: tool.path }, { default: () => tool.name });
|
||||
const makeIcon = (tool: Tool) => () => h(MenuIconItem, { tool });
|
||||
|
||||
const menuOptions: MenuGroupOption[] = toolsByCategory.map((category) => ({
|
||||
label: category.name,
|
||||
key: category.name,
|
||||
type: 'group',
|
||||
children: category.components.map((tool) => ({
|
||||
label: makeLabel(tool),
|
||||
icon: makeIcon(tool),
|
||||
key: tool.name,
|
||||
const toolStore = useToolStore();
|
||||
|
||||
const menuOptions = computed<MenuGroupOption[]>(() =>
|
||||
[
|
||||
...(toolStore.favoriteTools.length > 0
|
||||
? [{ name: 'Your favorite tools', components: toolStore.favoriteTools }]
|
||||
: []),
|
||||
...toolsByCategory,
|
||||
].map((category) => ({
|
||||
label: category.name,
|
||||
key: category.name,
|
||||
type: 'group',
|
||||
children: category.components.map((tool) => ({
|
||||
label: makeLabel(tool),
|
||||
icon: makeIcon(tool),
|
||||
key: tool.name,
|
||||
})),
|
||||
})),
|
||||
}));
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -102,60 +112,6 @@ const menuOptions: MenuGroupOption[] = toolsByCategory.map((category) => ({
|
|||
</template>
|
||||
|
||||
<template #content>
|
||||
<div class="navigation">
|
||||
<n-button
|
||||
:size="styleStore.isSmallScreen ? 'medium' : 'large'"
|
||||
circle
|
||||
quaternary
|
||||
aria-label="Toggle menu"
|
||||
@click="styleStore.isMenuCollapsed = !styleStore.isMenuCollapsed"
|
||||
>
|
||||
<n-icon size="25" :component="Menu2" />
|
||||
</n-button>
|
||||
|
||||
<router-link to="/" #="{ navigate, href }" custom>
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
tag="a"
|
||||
:href="href"
|
||||
:size="styleStore.isSmallScreen ? 'medium' : 'large'"
|
||||
circle
|
||||
quaternary
|
||||
aria-label="Home"
|
||||
@click="navigate"
|
||||
>
|
||||
<n-icon size="25" :component="Home2" />
|
||||
</n-button>
|
||||
</template>
|
||||
Home
|
||||
</n-tooltip>
|
||||
</router-link>
|
||||
|
||||
<search-bar />
|
||||
|
||||
<navbar-buttons v-if="!styleStore.isSmallScreen" />
|
||||
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-button
|
||||
round
|
||||
type="primary"
|
||||
tag="a"
|
||||
href="https://github.com/sponsors/CorentinTh"
|
||||
rel="noopener"
|
||||
target="_blank"
|
||||
class="support-button"
|
||||
:bordered="false"
|
||||
>
|
||||
Buy me a coffee
|
||||
|
||||
<n-icon v-if="!styleStore.isSmallScreen" :component="Heart" style="margin-left: 8px" size="20px" />
|
||||
</n-button>
|
||||
</template>
|
||||
❤ Support IT Tools development !
|
||||
</n-tooltip>
|
||||
</div>
|
||||
<slot />
|
||||
</template>
|
||||
</menu-layout>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue