added display names

This commit is contained in:
Nate Kelley 2025-02-24 14:21:45 -07:00
parent a61a63aa01
commit cb76a6e74a
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 89 additions and 64 deletions

View File

@ -65,8 +65,10 @@ export const ButtonDropdown = React.forwardRef<HTMLDivElement, ButtonDropdownPro
);
}
);
ButtonDropdown.displayName = 'ButtonDropdown';
export const ButtonSplit = React.forwardRef<
export const ButtonSplit = React.memo(
React.forwardRef<
HTMLDivElement,
Omit<ButtonDropdownProps, 'dropdownProps'> & {
open: boolean;
@ -101,7 +103,7 @@ export const ButtonSplit = React.forwardRef<
buttonVariants({ buttonType, size, rounding: 'none' }),
dropdownButtonVariants({ rounding }),
'gap-0 !bg-transparent p-0',
disabled && 'cursor-not-allowed opacity-60',
disabled && 'cursor-not-allowed opacity-70',
className
)}>
<div
@ -114,7 +116,11 @@ export const ButtonSplit = React.forwardRef<
) : (
icon && (
<span
className={cn(buttonIconVariants({ buttonType, size }), 'text-sm', iconClassName)}>
className={cn(
buttonIconVariants({ buttonType, size }),
'text-sm',
iconClassName
)}>
{icon}
</span>
)
@ -139,6 +145,22 @@ export const ButtonSplit = React.forwardRef<
</div>
);
}
),
(prevProps, nextProps) => {
return (
prevProps.className === nextProps.className &&
prevProps.buttonType === nextProps.buttonType &&
prevProps.size === nextProps.size &&
prevProps.icon === nextProps.icon &&
prevProps.buttonText === nextProps.buttonText &&
prevProps.disabled === nextProps.disabled &&
prevProps.rounding === nextProps.rounding &&
prevProps.loading === nextProps.loading &&
prevProps.iconClassName === nextProps.iconClassName &&
prevProps.open === nextProps.open &&
prevProps.onOpenChange === nextProps.onOpenChange
);
}
);
ButtonSplit.displayName = 'ButtonSplit';

View File

@ -102,6 +102,8 @@ export const Dropdown: React.FC<DropdownProps> = React.memo(
}
);
Dropdown.displayName = 'Dropdown';
const DropdownItemSelector: React.FC<{
item: DropdownItem | DropdownDivider;
index: number;
@ -216,3 +218,4 @@ const DropdownSubMenuWrapper = React.memo(
);
}
);
DropdownSubMenuWrapper.displayName = 'DropdownSubMenuWrapper';