Commit d412924605

d412924605a05276fed4d655f12ff41a27fc0164

parent: 3fc55f5043

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-07-09 04:30 UTC

Update AccentColor.vue

Layout: unified · split

docs/.vitepress/theme/components/settings/AccentColor.vue +32 −9
@@ -1,10 +1,11 @@
11<script setup lang="ts">
22import { useData } from 'vitepress'
3import { NuVerticalTransition } from '@nolebase/ui'
3import { NuInputHighlight, NuVerticalTransition } from '@nolebase/ui'
44import { useStorage } from '@vueuse/core'
55import { computed, onMounted, onUnmounted, ref } from 'vue'
66
77import { AccentColorStorageKey } from '../../constants'
8import MenuHelp from './MenuHelp.vue'
89import MenuTitle from './MenuTitle.vue'
910
1011const { isDark } = useData()
@@ -62,6 +63,8 @@ const accentColor = useStorage(AccentColorStorageKey, 'ayanami')
6263
6364const open = ref(false)
6465const rootRef = ref<HTMLDivElement>()
66const menuTitleElementRef = ref<HTMLDivElement>()
67const isMenuHelpPoppedUp = ref(false)
6568
6669const selectedOption = computed(
6770 () => accentOptions.find((o) => o.key === accentColor.value) ?? accentOptions[0]
@@ -88,13 +91,26 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true))
8891
8992<template>
9093 <div ref="rootRef" class="accent-color">
91 <MenuTitle title="Accent Color" aria-label="Accent Color" mb-2>
92 <template #icon>
93 <span i-lucide:swatch-book mr-1 aria-hidden="true" />
94 </template>
95 </MenuTitle>
94 <div ref="menuTitleElementRef" relative flex items-center mb-2>
95 <MenuTitle title="Accent Color" aria-label="Accent Color" flex="1" pr-4>
96 <template #icon>
97 <span i-lucide:swatch-book mr-1 aria-hidden="true" />
98 </template>
99 </MenuTitle>
100 <MenuHelp
101 v-model:is-popped-up="isMenuHelpPoppedUp"
102 :menu-title-element-ref="menuTitleElementRef"
103 >
104 <h4 text-md mb-1 font-semibold>Accent Color</h4>
105 <p text="sm" mb-2 max-w-100>
106 Sets the accent color used for links, buttons, and highlights across
107 the site.
108 </p>
109 </MenuHelp>
110 </div>
96111
97 <div class="accent-select" :class="{ 'accent-select--open': open }">
112 <NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md">
113 <div class="accent-select" :class="{ 'accent-select--open': open }">
98114 <button
99115 type="button"
100116 class="accent-trigger"
@@ -144,7 +160,8 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true))
144160 </button>
145161 </div>
146162 </NuVerticalTransition>
147 </div>
163 </div>
164 </NuInputHighlight>
148165 </div>
149166</template>
150167
@@ -158,9 +175,10 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true))
158175 align-items: center;
159176 gap: 8px;
160177 width: 100%;
178 min-height: 44px;
161179 padding: 7px 10px;
162180 border-radius: 8px;
163 border: 1px solid var(--vp-c-divider);
181 border: 2px solid var(--vp-c-divider);
164182 background: var(--wk-c-menu-bg);
165183 color: var(--vp-c-text-1);
166184 font-size: 13px;
@@ -192,6 +210,7 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true))
192210 margin-top: 6px;
193211 max-height: 240px;
194212 overflow-y: auto;
213 overscroll-behavior: contain;
195214 display: flex;
196215 flex-direction: column;
197216 gap: 2px;
@@ -225,6 +244,10 @@ onUnmounted(() => document.removeEventListener('click', onDocClick, true))
225244 background-color: var(--vp-c-brand-soft);
226245}
227246
247.accent-btn--selected .accent-label {
248 font-weight: 600;
249}
250
228251.accent-btn--selected:hover {
229252 background-color: var(--vp-c-brand-soft);
230253}