Skip to content

Commit aff9553

Browse files
committed
support the size property of the BlueprintJS button by forwarding it to the icon correctly
1 parent b06bec7 commit aff9553

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/components/Button/Button.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,18 @@ export const Button = ({
104104

105105
const ButtonType = restProps.href ? BlueprintAnchorButton : BlueprintButton;
106106

107+
const iconSize = {
108+
small: restProps["size"] === "small",
109+
large: restProps["size"] === "large",
110+
};
111+
107112
const button = (
108113
<ButtonType
109114
{...restProps}
110115
className={`${eccgui}-button ` + className}
111116
intent={(intent || intentByFunction) as BlueprintIntent}
112-
icon={typeof icon === "string" ? <Icon name={icon} /> : icon}
113-
rightIcon={typeof rightIcon === "string" ? <Icon name={rightIcon} /> : rightIcon}
117+
icon={typeof icon === "string" ? <Icon name={icon} {...iconSize} /> : icon}
118+
rightIcon={typeof rightIcon === "string" ? <Icon name={rightIcon} {...iconSize} /> : rightIcon}
114119
>
115120
{children}
116121
{badge && (

src/components/Icon/IconButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export const IconButton = ({
5454
swapPlaceholderDelay: 10,
5555
};
5656
const iconProps = {
57-
small: restProps.small,
58-
large: restProps.large,
57+
small: restProps.small || restProps["size"] === "small",
58+
large: restProps.large || restProps["size"] === "large",
5959
tooltipText: tooltipAsTitle ? undefined : text,
6060
tooltipProps: tooltipProps
6161
? {

0 commit comments

Comments
 (0)