From 49e8de17d146ba4734a887fdcf37de5d66f2603b Mon Sep 17 00:00:00 2001 From: Driss Chelouati Date: Thu, 7 Dec 2023 23:28:15 +0100 Subject: [PATCH] feat(Link): config redesign and implementation --- src/plugins/components/link/index.ts | 9 ++++++++- src/plugins/components/link/link.config.ts | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/plugins/components/link/index.ts b/src/plugins/components/link/index.ts index f777b71..a2105ec 100644 --- a/src/plugins/components/link/index.ts +++ b/src/plugins/components/link/index.ts @@ -16,7 +16,14 @@ export default plugin.withOptions( addComponents({ [`.${prefix}link`]: { - [`@apply font-${config.font} hover:text-${config.textHover} dark:hover:text-${config.textHoverDark} underline-offset-4 hover:underline focus:text-${config.textFocus} dark:focus:text-${config.textFocusDark} focus:underline`]: + //Base + [`@apply font-${config.font.family} underline-offset-4 hover:underline focus:underline`]: + {}, + //Hover + [`@apply hover:text-${config.font.color.hover.light} dark:hover:text-${config.font.color.hover.dark}`]: + {}, + //Focus + [`@apply focus:text-${config.font.color.focus.light} dark:focus:text-${config.font.color.focus.dark}`]: {}, }, }) diff --git a/src/plugins/components/link/link.config.ts b/src/plugins/components/link/link.config.ts index ddf7f36..79a4d7c 100644 --- a/src/plugins/components/link/link.config.ts +++ b/src/plugins/components/link/link.config.ts @@ -1,11 +1,19 @@ export const key = 'link' as const export const defaultConfig = { - font: 'sans', - textHover: 'primary-500', - textHoverDark: 'primary-400', - textFocus: 'primary-500', - textFocusDark: 'primary-400', + font: { + family: 'sans', + color: { + hover: { + light: 'primary-500', + dark: 'primary-400', + }, + focus: { + light: 'primary-500', + dark: 'primary-400', + }, + }, + }, } export type LinkPluginConfig = typeof defaultConfig