Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiButton][EuiButtonEmpty][EuiButtonIcon] Remove color="ghost" #7296

Merged
merged 9 commits into from
Oct 25, 2023
26 changes: 9 additions & 17 deletions src/components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,14 @@ export type Props = ExclusiveUnion<
* EuiButton is largely responsible for providing relevant props
* and the logic for element-specific attributes
*/
export const EuiButton: FunctionComponent<Props> = (props) => {
const {
className,
buttonRef,
color: _color = 'primary',
fill,
...rest
} = props;

export const EuiButton: FunctionComponent<Props> = ({
className,
buttonRef,
size = 'm',
color: _color = 'primary',
fill,
...rest
}) => {
const buttonIsDisabled = isButtonDisabled({
href: rest.href,
isDisabled: rest.isDisabled || rest.disabled,
Expand All @@ -113,15 +112,8 @@ export const EuiButton: FunctionComponent<Props> = (props) => {
className={classes}
css={cssStyles}
ref={buttonRef}
size={size}
{...rest}
/>
);
};

EuiButton.displayName = 'EuiButton';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it this was just redundant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, unless we're using forwardRef or have some other reason for renaming components (e.g. HOCs and other shenanigans), we don't need to manually set a displayName.


// Use defaultProps for simple pass-through props
EuiButton.defaultProps = {
size: 'm',
color: 'primary',
};
48 changes: 22 additions & 26 deletions src/components/button/button_empty/button_empty.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,32 +87,28 @@ export type EuiButtonEmptyProps = ExclusiveUnion<
EuiButtonEmptyPropsForButton
>;

export const EuiButtonEmpty: FunctionComponent<EuiButtonEmptyProps> = (
props
) => {
const {
children,
className,
iconType,
iconSide = 'left',
iconSize = 'm',
color: _color = 'primary',
size = 'm',
flush,
isDisabled: _isDisabled,
disabled,
isLoading,
href,
target,
rel,
type = 'button',
buttonRef,
contentProps,
textProps,
isSelected,
...rest
} = props;

export const EuiButtonEmpty: FunctionComponent<EuiButtonEmptyProps> = ({
children,
className,
iconType,
iconSide = 'left',
iconSize = 'm',
color: _color = 'primary',
size = 'm',
flush,
isDisabled: _isDisabled,
disabled,
isLoading,
href,
target,
rel,
type = 'button',
buttonRef,
contentProps,
textProps,
isSelected,
...rest
}) => {
const isDisabled = isButtonDisabled({
isDisabled: _isDisabled || disabled,
href,
Expand Down
38 changes: 18 additions & 20 deletions src/components/button/button_icon/button_icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,24 @@ type Props = ExclusiveUnion<
EuiButtonIconPropsForButton
>;

export const EuiButtonIcon: FunctionComponent<Props> = (props) => {
const {
className,
iconType,
iconSize = 'm',
color: _color = 'primary',
isDisabled: _isDisabled,
disabled,
href,
type = 'button',
display = 'empty',
target,
rel,
size = 'xs',
buttonRef,
isSelected,
isLoading,
...rest
} = props;

export const EuiButtonIcon: FunctionComponent<Props> = ({
className,
iconType,
iconSize = 'm',
color: _color = 'primary',
isDisabled: _isDisabled,
disabled,
href,
type = 'button',
display = 'empty',
target,
rel,
size = 'xs',
buttonRef,
isSelected,
isLoading,
...rest
}) => {
const euiThemeContext = useEuiTheme();
const isDisabled = isButtonDisabled({
isDisabled: _isDisabled || disabled,
Expand Down