mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-23 16:26:15 -04:00
feat(tools): new badge for recently created tools
This commit is contained in:
parent
ac89490794
commit
11720e6cde
33 changed files with 320 additions and 100 deletions
36
src/components/MenuIconItem.vue
Normal file
36
src/components/MenuIconItem.vue
Normal file
|
@ -0,0 +1,36 @@
|
|||
<template>
|
||||
<div class="menu-icon-item">
|
||||
<n-icon :component="tool.icon" />
|
||||
<div v-if="tool.isNew" class="badge"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ITool } from '@/tools/tool';
|
||||
import { useThemeVars } from 'naive-ui';
|
||||
import { toRefs } from 'vue';
|
||||
|
||||
const props = defineProps<{ tool: ITool }>();
|
||||
const { tool } = toRefs(props);
|
||||
|
||||
const theme = useThemeVars();
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.menu-icon-item {
|
||||
position: relative;
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
background-color: v-bind('theme.primaryColor');
|
||||
border-radius: 10px;
|
||||
line-height: 1;
|
||||
top: 3px;
|
||||
left: -6px;
|
||||
font-size: 10px;
|
||||
|
||||
height: 6px;
|
||||
width: 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,10 +1,24 @@
|
|||
<template>
|
||||
<router-link :to="tool.path">
|
||||
<n-card class="tool-card">
|
||||
<n-icon class="icon" size="40" :component="tool.icon" />
|
||||
<n-space justify="space-between" align="center">
|
||||
<n-icon class="icon" size="40" :component="tool.icon" />
|
||||
<n-tag
|
||||
v-if="tool.isNew"
|
||||
size="small"
|
||||
class="badge-new"
|
||||
round
|
||||
type="success"
|
||||
:bordered="false"
|
||||
:color="{ color: theme.primaryColor, textColor: theme.tagColor }"
|
||||
>
|
||||
New
|
||||
</n-tag>
|
||||
</n-space>
|
||||
<n-h3 class="title">
|
||||
<n-ellipsis>{{ tool.name }}</n-ellipsis>
|
||||
</n-h3>
|
||||
|
||||
<div class="description">
|
||||
<n-ellipsis :line-clamp="2" :tooltip="false">
|
||||
{{ tool.description }}
|
||||
|
@ -15,11 +29,13 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ITool } from '@/tools/Tool';
|
||||
import type { ITool } from '@/tools/tool';
|
||||
import { useThemeVars } from 'naive-ui';
|
||||
import { toRefs } from 'vue';
|
||||
|
||||
const props = defineProps<{ tool: ITool & { category: string } }>();
|
||||
const { tool } = toRefs(props);
|
||||
const theme = useThemeVars();
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue