Skip to content

Commit 9c15fd4

Browse files
committed
feat: enhance GradientPalette component with ShikiBlock for Tailwind output and update build config for CSS output
1 parent c5c84e3 commit 9c15fd4

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

docs/.vitepress/theme/components/GradientPalette.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import { computed, ref, Teleport, nextTick, watch } from 'vue';
33
import CodeBlock from './CodeBlock.vue';
4-
import { computedAsync } from '@vueuse/core';
4+
import ShikiBlock from './ShikiBlock.vue';
55
66
const gradients = ['Neutral', 'Blue', 'Green', 'Red', 'Orange', 'Gold']
77
@@ -15,7 +15,10 @@ function setActiveGradient(gradient: string, darkened?: boolean) {
1515
}
1616
1717
const 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
2023
const 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>

packages/nimiq-vitepress-theme/build.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default defineBuildConfig({
5555
//
5656
// The use of CLI was suggested by how to use unocss with rollup? · unocss/unocss · Discussion #542
5757
// https:// github.com/unocss/unocss/discussions/542
58-
await execAsync('unocss "./src/**/*.vue" -o dist/style.css')
58+
await execAsync('unocss "./src/**/*.vue" -o dist/assets/index.css')
5959
},
6060
},
6161
})
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* An empty file to let vite know this file exists, but it will be replaced by UnoCSS */

packages/nimiq-vitepress-theme/src/layout/Layout.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import '../assets/index.css';
23
import PageContent from './PageContent.vue';
34
import Sidebar from './Sidebar.vue'
45
</script>

0 commit comments

Comments
 (0)