Fix icon picker width and add Icon Title (#2418)

- fixed icon picker width
- added icon title
This commit is contained in:
brendanlaschke
2023-11-10 11:52:50 +01:00
committed by GitHub
parent 7b9175a4a4
commit edd152910d
2 changed files with 5 additions and 1 deletions

View File

@ -18,7 +18,7 @@ export type LightIconButtonProps = {
disabled?: boolean; disabled?: boolean;
focus?: boolean; focus?: boolean;
onClick?: (event: MouseEvent<HTMLButtonElement>) => void; onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
} & Pick<ComponentProps<'button'>, 'aria-label'>; } & Pick<ComponentProps<'button'>, 'aria-label' | 'title'>;
const StyledButton = styled.button< const StyledButton = styled.button<
Pick<LightIconButtonProps, 'accent' | 'active' | 'size' | 'focus'> Pick<LightIconButtonProps, 'accent' | 'active' | 'size' | 'focus'>
@ -90,6 +90,7 @@ export const LightIconButton = ({
disabled = false, disabled = false,
focus = false, focus = false,
onClick, onClick,
title,
}: LightIconButtonProps) => { }: LightIconButtonProps) => {
const theme = useTheme(); const theme = useTheme();
return ( return (
@ -103,6 +104,7 @@ export const LightIconButton = ({
className={className} className={className}
size={size} size={size}
active={active} active={active}
title={title}
> >
{Icon && <Icon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />} {Icon && <Icon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />}
</StyledButton> </StyledButton>

View File

@ -84,6 +84,7 @@ export const IconPicker = ({
variant={variant} variant={variant}
/> />
} }
dropdownMenuWidth={168}
dropdownComponents={ dropdownComponents={
<DropdownMenu width={168}> <DropdownMenu width={168}>
<DropdownMenuSearchInput <DropdownMenuSearchInput
@ -103,6 +104,7 @@ export const IconPicker = ({
aria-label={convertIconKeyToLabel(iconKey)} aria-label={convertIconKeyToLabel(iconKey)}
isSelected={selectedIconKey === iconKey} isSelected={selectedIconKey === iconKey}
size="medium" size="medium"
title={iconKey}
Icon={icons[iconKey]} Icon={icons[iconKey]}
onClick={() => { onClick={() => {
onChange({ iconKey, Icon: icons[iconKey] }); onChange({ iconKey, Icon: icons[iconKey] });