| 247 | }; |
| 248 | |
| 249 | export const useGetIconWithSizeV2 = ( |
| 250 | size: ButtonSize, |
| 251 | iconOnly: boolean, |
| 252 | iconPosition: ButtonIconPosition, |
| 253 | ): (( |
| 254 | icon: React.ReactElement<IconProps>, |
| 255 | iconSecondaryOnHover?: boolean, |
| 256 | ) => React.ReactElement<IconProps>) => { |
| 257 | return (icon: React.ReactElement<IconProps>, iconSecondaryOnHover = false) => |
| 258 | React.cloneElement(icon, { |
| 259 | secondary: iconSecondaryOnHover |
| 260 | ? !icon.props?.secondary |
| 261 | : icon.props?.secondary, |
| 262 | size: icon.props?.size ?? buttonSizeToIconSizeV2[size], |
| 263 | className: classNames( |
| 264 | icon.props.className, |
| 265 | 'btn-icon', |
| 266 | !iconOnly && 'text-base', |
| 267 | !iconOnly && |
| 268 | iconPosition === ButtonIconPosition.Left && |
| 269 | 'btn-icon-left', |
| 270 | !iconOnly && |
| 271 | iconPosition === ButtonIconPosition.Right && |
| 272 | 'btn-icon-right', |
| 273 | !iconOnly && iconPosition === ButtonIconPosition.Top && 'btn-icon-top', |
| 274 | ), |
| 275 | }); |
| 276 | }; |