From ec6cd67ac3cbf42e66e746de33db57ee00a8db3d Mon Sep 17 00:00:00 2001 From: Cahllagerfeld <43843195+Cahllagerfeld@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:12:44 +0000 Subject: [PATCH 1/2] feat: custom classgroups for font-sizes --- src/utilities.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/utilities.ts b/src/utilities.ts index 1b8f7b5..d2121c2 100644 --- a/src/utilities.ts +++ b/src/utilities.ts @@ -1,5 +1,22 @@ import { clsx, type ClassValue } from "clsx"; -import { twMerge } from "tailwind-merge"; +import { extendTailwindMerge } from "tailwind-merge"; + +const customTwMerge = extendTailwindMerge({ + classGroups: { + fontSize: [ + "text-text-xs", + "text-text-sm", + "text-text-md", + "text-text-lg", + "text-text-xl", + "text-display-xs", + "text-display-sm", + "text-display-md", + "text-display-lg", + "text-display-xl" + ] + } +}); /** * Merges tailwind utilities, and allows the usage of the clsx syntax in addition @@ -7,5 +24,5 @@ import { twMerge } from "tailwind-merge"; * @returns */ export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); + return customTwMerge(clsx(inputs)); } From 1ca03de7b3ad62f98c36f72175922ce35d9a232b Mon Sep 17 00:00:00 2001 From: Cahllagerfeld <43843195+Cahllagerfeld@users.noreply.github.com> Date: Tue, 22 Aug 2023 13:27:18 +0000 Subject: [PATCH 2/2] chore: add changeset --- .changeset/tasty-walls-float.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tasty-walls-float.md diff --git a/.changeset/tasty-walls-float.md b/.changeset/tasty-walls-float.md new file mode 100644 index 0000000..b649b0b --- /dev/null +++ b/.changeset/tasty-walls-float.md @@ -0,0 +1,5 @@ +--- +"@zenml-io/react-component-library": patch +--- + +provide custom `twMerge` utility