From 1622da5db91a2aa978265266a8f6f61e8b75ec8d Mon Sep 17 00:00:00 2001 From: taskylizard <75871323+taskylizard@users.noreply.github.com> Date: Thu, 27 Mar 2025 12:54:11 +0000 Subject: [PATCH] feat: improve feedback component, brand color picker --- docs/.vitepress/theme/Appearance.vue | 4 +- .../theme/components/ColorPicker.vue | 88 ++++++++++++++++++ docs/.vitepress/theme/components/Feedback.vue | 60 +++++++++--- .../theme/components/SidebarCard.vue | 15 +-- docs/.vitepress/theme/style.scss | 65 +++++++++++++ package.json | 3 + pnpm-lock.yaml | Bin 256687 -> 260981 bytes unocss.config.ts | 57 ++++++++++++ 8 files changed, 263 insertions(+), 29 deletions(-) create mode 100644 docs/.vitepress/theme/components/ColorPicker.vue diff --git a/docs/.vitepress/theme/Appearance.vue b/docs/.vitepress/theme/Appearance.vue index d2a81f015..6ea9f544c 100644 --- a/docs/.vitepress/theme/Appearance.vue +++ b/docs/.vitepress/theme/Appearance.vue @@ -29,8 +29,8 @@ onMounted(() => { > - - + + diff --git a/docs/.vitepress/theme/components/ColorPicker.vue b/docs/.vitepress/theme/components/ColorPicker.vue new file mode 100644 index 000000000..3615c4821 --- /dev/null +++ b/docs/.vitepress/theme/components/ColorPicker.vue @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + Selected: {{ normalizeColorName(selectedColor) }} + + + diff --git a/docs/.vitepress/theme/components/Feedback.vue b/docs/.vitepress/theme/components/Feedback.vue index 38a1c5dc5..847ba5e96 100644 --- a/docs/.vitepress/theme/components/Feedback.vue +++ b/docs/.vitepress/theme/components/Feedback.vue @@ -69,10 +69,12 @@ const isDisabled = computed(() => { }) const router = useRouter() -// prettier-ignore -const feedback = reactive< - Pick & Partial> ->({ + +const feedback = reactive<{ + message: string + page: string + type?: FeedbackType['type'] +}>({ page: router.route.path, message: '' }) @@ -142,17 +144,45 @@ const toggleCard = () => (isCardShown.value = !isCardShown.value) - - - Send Feedback - + + + + + + + + + + Got feedback? + + + We'd love to know what you think about this page. + + + + + Share Feedback + + + + + @@ -254,7 +284,7 @@ const toggleCard = () => (isCardShown.value = !isCardShown.value) diff --git a/docs/.vitepress/theme/components/SidebarCard.vue b/docs/.vitepress/theme/components/SidebarCard.vue index 6821f3590..48f0bb316 100644 --- a/docs/.vitepress/theme/components/SidebarCard.vue +++ b/docs/.vitepress/theme/components/SidebarCard.vue @@ -1,5 +1,6 @@ @@ -16,7 +17,7 @@ import ToggleStarred from './ToggleStarred.vue' Indexes Storage Links Recommendations - + Options @@ -25,16 +26,6 @@ import ToggleStarred from './ToggleStarred.vue' - - - Star on GitHub - - + diff --git a/docs/.vitepress/theme/style.scss b/docs/.vitepress/theme/style.scss index fcf538187..fe5d10206 100644 --- a/docs/.vitepress/theme/style.scss +++ b/docs/.vitepress/theme/style.scss @@ -257,6 +257,71 @@ #VPContent strong > a { font-weight: bold; } +.info.custom-block a { + color: var(--vp-custom-block-info-text); + font-weight: 500; + text-decoration: underline; + text-underline-offset: 2px; + transition: opacity 0.25s; +} + +.info.custom-block a:hover { + opacity: 0.7; + color: var(--vp-custom-block-info-text-deep); +} + +.note.custom-block a { + color: var(--vp-custom-block-info-text); + font-weight: 500; + text-decoration: underline; + text-underline-offset: 2px; + transition: opacity 0.25s; +} + +.note.custom-block a:hover { + opacity: 0.7; + color: var(--vp-custom-block-note-text-deep); +} + +.tip.custom-block a { + color: var(--vp-custom-block-tip-text); + font-weight: 500; + text-decoration: underline; + text-underline-offset: 2px; + transition: opacity 0.25s; +} + +.tip.custom-block a:hover { + opacity: 0.7; + color: var(--vp-custom-block-tip-text-deep); +} + +.warning.custom-block a { + color: var(--vp-custom-block-warning-text); + font-weight: 500; + text-decoration: underline; + text-underline-offset: 2px; + transition: opacity 0.25s; +} + +.warning.custom-block a:hover { + opacity: 0.7; + color: var(--vp-custom-block-warning-text-deep); +} + +.danger.custom-block a { + color: var(--vp-custom-block-danger-text); + font-weight: 500; + text-decoration: underline; + text-underline-offset: 2px; + transition: opacity 0.25s; +} + +.danger.custom-block a:hover { + opacity: 0.7; + color: var(--vp-custom-block-danger-text-deep); +} + .info.custom-block { --icon: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGNsYXNzPSJsdWNpZGUgbHVjaWRlLWluZm8iPjxjaXJjbGUgY3g9IjEyIiBjeT0iMTIiIHI9IjEwIi8+PHBhdGggZD0iTTEyIDE2di00Ii8+PHBhdGggZD0iTTEyIDhoLjAxIi8+PC9zdmc+'); } diff --git a/package.json b/package.json index 4670a4b44..50d366f33 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "docs:dev": "vitepress dev docs/", "docs:preview": "vitepress preview docs/", "format": "prettier -w --cache --check .", + "licenser": "deno run --allow-read jsr:@kt3k/license-checker@3.3.1/main", "og:dev": "x-satori -t ./docs/.vitepress/hooks/Template.vue -c ./.vitepress/hooks/satoriConfig.ts --dev" }, "dependencies": { @@ -31,6 +32,7 @@ "nitropack": "^2.11.6", "nprogress": "^0.2.0", "pathe": "^2.0.1", + "reka-ui": "^2.1.1", "unocss": "66.1.0-beta.3", "vitepress": "^1.6.3", "vue": "^3.5.13", @@ -44,6 +46,7 @@ "@iconify-json/heroicons-solid": "^1.2.0", "@iconify-json/lucide": "^1.2.10", "@iconify-json/mdi": "^1.2.1", + "@iconify-json/ph": "^1.2.2", "@iconify-json/simple-icons": "^1.2.12", "@iconify-json/twemoji": "^1.2.1", "@iconify/utils": "^2.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 57833459216c5fde2d88ae86276e96e2548603e2..195c6da8f1ab38792305598175a7ace3e64d9262 100644 GIT binary patch delta 2760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mSdU-5Vea?{;Aq?)^#m zvM9a2w{(82TRD$C;$f@%!|7Ab-WMC*FFq#Sc1``#{0RY3rvU*Fy&uJmz=vHx$p6sB zJR}#KuFnTQzxZPEMF_ayymc11{G4yo1#=U9|6m@Tygr|X{rVfv%>MMQ=lcf^?f5_F zymil0o4FSK;PA&gvvczU&l>LA++$b^;$6!^cbNYqUtLt6d3^QEb;P$XKe^}N9VbNR zLp$f(zvDUKeEuYWF1%|QniF~LB=CcUwH%sT%Y3B-0fYl?dyda{9XsN-_VC3k>%c|l z^=;3A*}*4(QkNL~G^{h+u;rqZdSN_j2 zy2LN$?CNda>v`wYJ>W?4QOf2)xM)5M26y%F=(e52T5NPP%kgb{p4(yOzh@tJP7FLp zotFYY=@k3Xo#%pwox7%c<>{}0r<~W;fyCuc(acA`nvUx^tFyOn0{>V8T*=RVejB)O UVV?ypgy{0~;%xgp;CILV1Kdc1G5`Po delta 206 zcmV;<05Sjd_7AVs53uP31a)q2W0PQ zB)8Qs0-j&D-;e^^PPek*0=Wf~fSnPO?3@XgxgG-)myqZJB)1Ca0=)>gZ}9@BDVKX2 z0~nXT0|5n>avK8^m#iBDlegU*0}m;e^*;d=w>w4yZfUm#vI7qum!i!A7q=VG0~;T= IpYH?K3v{ { + const property = + type === 'text' + ? 'color' + : type === 'bg' + ? 'background-color' + : 'border-color' + + return colorScales.map( + (scale) => + [ + new RegExp(`^${type}-(${colorPattern})-${scale}$`), + ([, color]) => ({ [property]: colors[color][scale] }) + ] as const + ) +} + export default defineConfig({ content: { filesystem: ['.vitepress/config.mts', '.vitepress/constants.ts'] @@ -39,6 +72,30 @@ export default defineConfig({ div: 'var(--vp-c-divider)' } }, + rules: [ + // Brand color utilities + [ + /^brand-(\d+)$/, + ([, d]) => ({ color: `var(--vp-c-brand-${d})` }) + ] as const, + [ + /^bg-brand-(\d+)$/, + ([, d]) => ({ 'background-color': `var(--vp-c-brand-${d})` }) + ] as const, + [ + /^border-brand-(\d+)$/, + ([, d]) => ({ 'border-color': `var(--vp-c-brand-${d})` }) + ] as const, + [ + /^text-brand-(\d+)$/, + ([, d]) => ({ color: `var(--vp-c-brand-${d})` }) + ] as const, + + // Color scale utilities + ...createColorRules('text'), + ...createColorRules('bg'), + ...createColorRules('border') + ], presets: [ presetUno(), presetAttributify(),