From 934aa2244bfe8adea0c49cf87aa4b88a280008ae Mon Sep 17 00:00:00 2001 From: p-sw Date: Tue, 21 May 2024 19:37:40 +0900 Subject: [PATCH] docs: add comments in shared.ts --- packages/react/shared.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/react/shared.ts b/packages/react/shared.ts index a4d291d..c889512 100644 --- a/packages/react/shared.ts +++ b/packages/react/shared.ts @@ -72,6 +72,7 @@ type VariantKV = { * opened: false, * size: "md", * color: "green", + * className: "transition-opacity", * }, * } * ``` @@ -80,7 +81,14 @@ type PresetType = { [PresetName in N]: Partial> & { className?: string }; }; -export function vcn({ +/** + * A utility function to provide variants and presets to the component + * + * @param config - Variant Configuration + * @returns function (variantProps) -> class name, + * @returns function (anyProps) -> [variantProps, otherProps] + */ +export function vcn({ base, variants, defaults, @@ -133,7 +141,7 @@ export function vcn({ : defaultValue) ] ), - currentPreset?.className, + currentPreset?.className, // preset's classname comes after user's variant props? huh.. className ); },