mirror of
https://github.com/block/buzz.git
synced 2026-10-29 13:31:44 +00:00
Signed-off-by: Arjun Mahanti <arjun@squareup.com> Co-authored-by: Codex <noreply@openai.com>
13 lines
476 B
TypeScript
13 lines
476 B
TypeScript
/** Joins optional class names without rewriting semantic size roles. */
|
|
export function cx(...values: Array<string | false | undefined>) {
|
|
return values.filter(Boolean).join(" ");
|
|
}
|
|
/** Preserves Base UI state-aware className callbacks when adding the Buzz skin. */
|
|
export function skin<State>(
|
|
base: string,
|
|
custom?: string | ((state: State) => string | undefined),
|
|
) {
|
|
return (state: State) =>
|
|
cx(base, typeof custom === "function" ? custom(state) : custom);
|
|
}
|