Skip to content

Commit

Permalink
refactor(Button): unconstrain children
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Jul 15, 2024
1 parent f3db1af commit 0d1ae6d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export interface ButtonProps extends React.ComponentPropsWithRef<"button"> {
size?: "auto" | "sm" | "md" | "lg";
icon?: React.ReactNode;
shape?: "rectangle" | "pill";
children?: string;
}

const defaultRender: ButtonProps["render"] = (props) => (
Expand Down Expand Up @@ -41,14 +40,11 @@ export const Button = forwardRef(function Button(
size === "lg" && "gap-1.5 px-6",
),
),
children:
icon == null ? (
children
) : (
<>
{icon} {children}
</>
),
children: (
<>
{icon} <span>{children}</span>
</>
),
...props,
});
});

0 comments on commit 0d1ae6d

Please sign in to comment.