it-tools/src/components/ToolCard.vue

67 lines
1.4 KiB
Vue
Raw Normal View History

2022-04-05 23:23:08 +02:00
<template>
2022-04-15 23:10:47 +02:00
<router-link :to="tool.path">
<n-card class="tool-card">
<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>
2022-04-15 23:10:47 +02:00
<n-h3 class="title">
<n-ellipsis>{{ tool.name }}</n-ellipsis>
</n-h3>
2022-04-15 23:10:47 +02:00
<div class="description">
2022-04-22 23:31:40 +02:00
<n-ellipsis :line-clamp="2" :tooltip="false">
2022-04-15 23:10:47 +02:00
{{ tool.description }}
</n-ellipsis>
</div>
</n-card>
</router-link>
2022-04-05 23:23:08 +02:00
</template>
<script setup lang="ts">
import type { ITool } from '@/tools/tool';
import { useThemeVars } from 'naive-ui';
import { toRefs } from 'vue';
2022-04-05 23:23:08 +02:00
2022-04-22 23:31:40 +02:00
const props = defineProps<{ tool: ITool & { category: string } }>();
const { tool } = toRefs(props);
const theme = useThemeVars();
2022-04-05 23:23:08 +02:00
</script>
<style lang="less" scoped>
a {
2022-04-22 23:31:40 +02:00
text-decoration: none;
2022-04-05 23:23:08 +02:00
}
.tool-card {
2022-04-22 23:31:40 +02:00
&:hover {
border-color: var(--n-color-target);
}
.icon {
opacity: 0.6;
color: v-bind('theme.textColorBase');
2022-04-22 23:31:40 +02:00
}
.title {
margin: 5px 0;
}
.description {
opacity: 0.6;
color: v-bind('theme.textColorBase');
2022-04-22 23:31:40 +02:00
margin: 5px 0;
}
2022-04-05 23:23:08 +02:00
}
2022-04-22 23:31:40 +02:00
</style>