docs/.vitepress/theme/components/GradientCard.vue

1ed3089066ccaca7b4cc338342237b8e0bdf195a
wotaku/docs/.vitepress/theme/components/GradientCard.vue
taskylizard chore: update license0dddca8d19 1 year ago

104 lines · 3001 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
 70      :class="`${theme.bgleft} ${classes.bgleft} absolute top-1/3 -translate-y-1/2 rounded-full mix-blend`"
 71    ></div>
 72    <div
 73      :class="`${theme.bgright} ${classes.bgright} absolute left-1/2 -translate-x-1/2 rounded-full mix-blend`"
 74    ></div>
 75    <div :class="`absolute ${classes.icon}`">
 76      <div class="flex items-start">
 77        <div
 78          :class="classes.title"
 79          class="font-normal tracking-tighter text-color-50"
 80        >
 81          {{ props.title }}
 82        </div>
 83        <a v-if="props.link" :href="props.link" target="_blank">
 84          <svg
 85            xmlns="http://www.w3.org/2000/svg"
 86            viewBox="0 0 20 20"
 87            fill="currentColor"
 88            :class="theme.tag"
 89            class="w-8 h-8 ml-3"
 90          >
 91            <path
 92              fill-rule="evenodd"
 93              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"
 94              clip-rule="evenodd"
 95            ></path>
 96          </svg>
 97        </a>
 98      </div>
 99      <div :class="`${theme.description} ${classes.description}`">
100        {{ props.description }}
101      </div>
102    </div>
103  </div>
104</template>
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form