it-tools/src/components/ToolCard.vue

79 lines
1.7 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import { useThemeVars } from 'naive-ui';
import FavoriteButton from './FavoriteButton.vue';
import { useAppTheme } from '@/ui/theme/themes';
import type { Tool } from '@/tools/tools.types';
const props = defineProps<{ tool: Tool & { category: string } }>();
const { tool } = toRefs(props);
const theme = useThemeVars();
const appTheme = useAppTheme();
</script>
2022-04-05 23:23:08 +02:00
<template>
2022-04-15 23:10:47 +02:00
<router-link :to="tool.path">
<c-card class="tool-card">
2023-05-27 17:36:15 +02:00
<div flex items-center justify-between>
<n-icon class="icon" size="40" :component="tool.icon" />
2023-05-27 17:36:15 +02:00
<div flex items-center gap-8px>
<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>
<FavoriteButton :tool="tool" />
2023-05-27 17:36:15 +02:00
</div>
</div>
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">
<n-ellipsis :line-clamp="2" :tooltip="false" style="min-height: 44.78px">
2022-04-15 23:10:47 +02:00
{{ tool.description }}
<br>&nbsp;
2022-04-15 23:10:47 +02:00
</n-ellipsis>
</div>
</c-card>
2022-04-15 23:10:47 +02:00
</router-link>
2022-04-05 23:23:08 +02:00
</template>
<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 {
transition: border-color ease 0.5s;
border-width: 2px !important;
color: transparent;
2022-04-22 23:31:40 +02:00
&:hover {
border-color: v-bind('appTheme.primary.colorHover');
2022-04-22 23:31:40 +02:00
}
.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>