11<script setup lang="ts">
22import { computed , ref , Teleport , nextTick , watch } from ' vue' ;
33import CodeBlock from ' ./CodeBlock.vue' ;
4- import { computedAsync } from ' @vueuse/core ' ;
4+ import ShikiBlock from ' ./ShikiBlock.vue ' ;
55
66const gradients = [' Neutral' , ' Blue' , ' Green' , ' Red' , ' Orange' , ' Gold' ]
77
@@ -15,7 +15,10 @@ function setActiveGradient(gradient: string, darkened?: boolean) {
1515}
1616
1717const cssVar = computed (() => ` background-image: var(--nq-${activeGradient .value ?.color .toLowerCase ()}-gradient${activeGradient .value ?.darkened ? ' -darkened' : ' ' }) ` )
18- const tailwind = computed (() => ` bg-gradient-${activeGradient .value ?.color .toLowerCase ()}<br />hover:bg-gradient-${activeGradient .value ?.color .toLowerCase ()}-darkened ` )
18+ const tailwind = computed (() => {
19+ const className = ` bg-gradient-${activeGradient .value ?.color .toLowerCase ()} hover:bg-gradient-${activeGradient .value ?.color .toLowerCase ()}-darkened transition-colors `
20+ return ` <div class="${className }" /> `
21+ })
1922
2023const card= ref <HTMLDivElement >()
2124
@@ -31,6 +34,9 @@ watch(activeGradient, async () => {
3134
3235<template >
3336 <div grid =" ~ cols-[auto_1fr_1fr] items-center gap-16" f-my-md class =" nq-raw" max-w-800 relative >
37+ <div ></div >
38+ <span nq-label text-center >Default</span >
39+ <span nq-label text-center >Darkened</span >
3440 <div v-for =" gradient in gradients" :key =" gradient" contents >
3541 <p text =" neutral-700 right" font-semibold f-text-xs sm:pr-24 >{{ gradient }}</p >
3642 <button bg-transparent :style =" getBg(`${gradient}`)" max-h-48 aspect-square w-full rounded =" 4 md:6"
@@ -49,10 +55,10 @@ watch(activeGradient, async () => {
4955 <CodeBlock :code =" css!" text-wrap />
5056
5157 <span block nq-label text-10 f-mt-md mb-2 >CSS Variable</span >
52- <CodeBlock :code =" cssVar" text-wrap />
58+ <CodeBlock :code =" `${ cssVar}; /* Defined in nq-colors layer */` " text-wrap />
5359
5460 <span block nq-label text-10 f-mt-md mb-2 >Tailwind / UnoCSS</span >
55- <CodeBlock :code =" tailwind" text-wrap />
61+ <ShikiBlock :code =" tailwind" lang = " html " />
5662 </div >
5763 </Teleport >
5864 </ClientOnly >
0 commit comments