docs/.vitepress/theme/components/GradientCard.vue
103 lines · 3002 bytes
1<!--
2 All Rights Reserved
3
4 Copyright (c) 2025 taskylizard
5
6 All rights reserved. This code and its associated files may not be copied, modified, distributed, sublicensed, or used in any form, in whole or in part, without prior written permission from the copyright holder.
7-->
8<script setup lang="ts">
9import { computed } from 'vue'
10
11const props = withDefaults(
12 defineProps<{
13 variant?: 'default' | 'thin'
14 tag?: string
15 link?: string
16 title: string
17 description: string
18 theme: string
19 }>(),
20 { variant: 'default' }
21)
22
23const theme = computed(() => {
24 return {
25 title: `text-${props.theme}-100`,
26 bgleft: `bg-${props.theme}-800`,
27 bgright: `bg-${props.theme}-700`,
28 tag: `text-${props.theme}-300`,
29 description: `text-${props.theme}-100`
30 }
31})
32
33const classes = computed(() => {
34 if (props.variant === 'thin') {
35 return {
36 container: 'h-40 text-sm',
37 bgleft: 'h-40 w-40 blur-2xl -left-20',
38 bgright: 'h-60 w-60 blur-2xl -top-24',
39 title: 'text-3xl',
40 icon: 'top-12 left-4',
41 description: 'mt-2 text-sm'
42 }
43 } else {
44 return {
45 container: 'h-96',
46 bgleft: 'h-80 w-80 blur-3xl -left-32',
47 bgright: 'h-96 w-96 blur-3xl -top-56',
48 title: 'text-6xl',
49 icon: 'top-36 left-6',
50 description: 'mt-4'
51 }
52 }
53})
54</script>
55
56<template>
57 <div
58 style="box-shadow: 0 10px 40px -12px rgba(16, 24, 40, 0.1)"
59 :class="classes.container"
60 class="rounded-2xl border-2 border-amber overflow-hidden flex flex-col relative text-color dark:bg-zinc-900 bg-zinc-100"
61 >
62 <div class="p-4 sticky top-0 z-10">
63 <div class="flex items-center gap-1.5">
64 <div :class="theme.tag" class="font-medium">
65 {{ props.tag }}
66 </div>
67 </div>
68 </div>
69 <div :class="`${theme.bgleft} ${classes.bgleft} absolute top-1/3 -translate-y-1/2 rounded-full mix-blend`">
70 </div>
71 <div :class="`${theme.bgright} ${classes.bgright} absolute left-1/2 -translate-x-1/2 rounded-full mix-blend`">
72 </div>
73 <div :class="`absolute ${classes.icon}`">
74 <div class="flex items-start">
75 <div
76 :class="classes.title"
77 class="font-normal tracking-tighter text-color-50"
78 >
79 {{ props.title }}
80 </div>
81 <a v-if="props.link" :href="props.link" target="_blank">
82 <svg
83 xmlns="http://www.w3.org/2000/svg"
84 viewBox="0 0 20 20"
85 fill="currentColor"
86 :class="theme.tag"
87 class="w-8 h-8 ml-3"
88 >
89 <path
90 fill-rule="evenodd"
91 d="M5.22 14.78a.75.75 0 001.06 0l7.22-7.22v5.69a.75.75 0 001.5 0v-7.5a.75.75 0 00-.75-.75h-7.5a.75.75 0 000 1.5h5.69l-7.22 7.22a.75.75 0 000 1.06z"
92 clip-rule="evenodd"
93 >
94 </path>
95 </svg>
96 </a>
97 </div>
98 <div :class="`${theme.description} ${classes.description}`">
99 {{ props.description }}
100 </div>
101 </div>
102 </div>
103</template>