Skip to content

Commit

Permalink
fix: className prop passing in button components
Browse files Browse the repository at this point in the history
  • Loading branch information
malangcat committed Jan 4, 2025
1 parent d8726e9 commit bfe9b13
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 60 deletions.
1 change: 0 additions & 1 deletion docs/registry/ui/action-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const ActionButton = React.forwardRef<
>(
(
{
className,
loading = false,
layout = "withText",
prefixIcon,
Expand Down
5 changes: 1 addition & 4 deletions docs/registry/ui/action-chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ export interface ActionChipProps extends SeedActionChip.RootProps {
}

export const ActionChip = React.forwardRef<HTMLButtonElement, ActionChipProps>(
(
{ className, children, prefixIcon, suffixIcon, count, ...otherProps },
ref,
) => {
({ children, prefixIcon, suffixIcon, count, ...otherProps }, ref) => {
return (
<SeedActionChip.Root ref={ref} {...otherProps}>
{otherProps.layout === "withText" ? (
Expand Down
37 changes: 16 additions & 21 deletions docs/registry/ui/control-chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,22 @@ export interface ControlChipToggleProps extends SeedControlChip.RootProps {
export const ControlChipToggle = React.forwardRef<
HTMLLabelElement,
ControlChipToggleProps
>(
(
{ className, children, prefixIcon, suffixIcon, count, ...otherProps },
ref,
) => {
return (
<SeedControlChip.Root ref={ref} {...otherProps}>
{otherProps.layout === "withText" ? (
<>
{prefixIcon && <SeedControlChip.PrefixIcon svg={prefixIcon} />}
<SeedControlChip.Label>{children}</SeedControlChip.Label>
{count && <SeedControlChip.Count>{count}</SeedControlChip.Count>}
{suffixIcon && <SeedControlChip.SuffixIcon svg={suffixIcon} />}
</>
) : (
<SeedControlChip.Icon svg={children} />
)}
</SeedControlChip.Root>
);
},
);
>(({ children, prefixIcon, suffixIcon, count, ...otherProps }, ref) => {
return (
<SeedControlChip.Root ref={ref} {...otherProps}>
{otherProps.layout === "withText" ? (
<>
{prefixIcon && <SeedControlChip.PrefixIcon svg={prefixIcon} />}
<SeedControlChip.Label>{children}</SeedControlChip.Label>
{count && <SeedControlChip.Count>{count}</SeedControlChip.Count>}
{suffixIcon && <SeedControlChip.SuffixIcon svg={suffixIcon} />}
</>
) : (
<SeedControlChip.Icon svg={children} />
)}
</SeedControlChip.Root>
);
});
ControlChipToggle.displayName = "ControlChip.Toggle";

export const ControlChip = Object.assign(
Expand Down
2 changes: 1 addition & 1 deletion docs/registry/ui/extended-fab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface ExtendedFabProps extends SeedExtendedFab.RootProps {
export const ExtendedFab = React.forwardRef<
HTMLButtonElement,
ExtendedFabProps
>(({ className, children, prefixIcon, ...otherProps }, ref) => {
>(({ children, prefixIcon, ...otherProps }, ref) => {
return (
<SeedExtendedFab.Root ref={ref} {...otherProps}>
{prefixIcon && <SeedExtendedFab.PrefixIcon svg={prefixIcon} />}
Expand Down
2 changes: 1 addition & 1 deletion docs/registry/ui/fab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface FabProps extends SeedFab.RootProps {}
* @see https://v3.seed-design.io/docs/react/components/fab
*/
export const Fab = React.forwardRef<HTMLButtonElement, FabProps>(
({ className, children, ...otherProps }, ref) => {
({ children, ...otherProps }, ref) => {
if (!(otherProps["aria-label"] || otherProps["aria-labelledby"])) {
console.warn(
"'aria-label' or 'aria-labelledby' should be provided in <Fab />.",
Expand Down
25 changes: 10 additions & 15 deletions docs/registry/ui/reaction-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,16 @@ export interface ReactionButtonProps extends SeedReactionButton.RootProps {
export const ReactionButton = React.forwardRef<
React.ElementRef<typeof SeedReactionButton.Root>,
ReactionButtonProps
>(
(
{ className, loading = false, prefixIcon, count, children, ...otherProps },
ref,
) => {
return (
<SeedReactionButton.Root ref={ref} loading={loading} {...otherProps}>
{prefixIcon && <SeedReactionButton.PrefixIcon svg={prefixIcon} />}
<SeedReactionButton.Label>{children}</SeedReactionButton.Label>
<SeedReactionButton.Count>{count}</SeedReactionButton.Count>
{loading ? <SeedReactionButton.ProgressCircle /> : null}
</SeedReactionButton.Root>
);
},
);
>(({ loading = false, prefixIcon, count, children, ...otherProps }, ref) => {
return (
<SeedReactionButton.Root ref={ref} loading={loading} {...otherProps}>
{prefixIcon && <SeedReactionButton.PrefixIcon svg={prefixIcon} />}
<SeedReactionButton.Label>{children}</SeedReactionButton.Label>
<SeedReactionButton.Count>{count}</SeedReactionButton.Count>
{loading ? <SeedReactionButton.ProgressCircle /> : null}
</SeedReactionButton.Root>
);
});
ReactionButton.displayName = "ReactionButton";

/**
Expand Down
9 changes: 1 addition & 8 deletions docs/registry/ui/toggle-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,7 @@ export const ToggleButton = React.forwardRef<
ToggleButtonProps
>(
(
{
className,
loading = false,
prefixIcon,
suffixIcon,
children,
...otherProps
},
{ loading = false, prefixIcon, suffixIcon, children, ...otherProps },
ref,
) => {
return (
Expand Down
10 changes: 1 addition & 9 deletions examples/stackflow-spa/src/design-system/ui/action-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ export const ActionButton = React.forwardRef<
ActionButtonProps
>(
(
{
className,
loading = false,
layout = "withText",
prefixIcon,
suffixIcon,
children,
...otherProps
},
{ loading = false, layout = "withText", prefixIcon, suffixIcon, children, ...otherProps },
ref,
) => {
return (
Expand Down

0 comments on commit bfe9b13

Please sign in to comment.