From 7afef6c0dd1b094ae1da58165b020984803e6584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marti=CC=81n?= Date: Wed, 18 Dec 2024 17:38:07 +0100 Subject: [PATCH] Add link variant snippets for nuxt --- .../adapter-nuxt/src/hooks/snippet-read.ts | 18 ++++++++++++------ .../adapter-nuxt2/src/hooks/snippet-read.ts | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/packages/adapter-nuxt/src/hooks/snippet-read.ts b/packages/adapter-nuxt/src/hooks/snippet-read.ts index 03eaf4c98..763b4ff00 100644 --- a/packages/adapter-nuxt/src/hooks/snippet-read.ts +++ b/packages/adapter-nuxt/src/hooks/snippet-read.ts @@ -61,25 +61,31 @@ export const snippetRead: SnippetReadHook = async ( const repeat = data.model.config?.repeat ?? false; const allowText = data.model.config?.allowText ?? false; + const allowVariants = Boolean(data.model.config?.variants); + const variant = (path: string) => + allowVariants ? ` :class="${path}.variant"` : ""; + + const path = dotPath(fieldPath); + let codeText; if (!repeat && !allowText) { codeText = stripIndent` - Link + Link `; } else if (!repeat && allowText) { codeText = stripIndent` - + `; } else if (repeat && !allowText) { codeText = stripIndent` -