Skip to content

Commit

Permalink
fix: eng-22373: take care special cases
Browse files Browse the repository at this point in the history
take care splitting button and 2-state button
  • Loading branch information
yzhang-eightfold committed Jun 30, 2022
1 parent 45e27ed commit 62873cb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/components/Button/BaseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const BaseButton: FC<InternalButtonProps> = React.forwardRef(
disabled = false,
disruptive = false,
dropShadow = false,
floatingButtonProps,
htmlType,
iconProps,
id,
Expand All @@ -40,7 +41,6 @@ export const BaseButton: FC<InternalButtonProps> = React.forwardRef(
split,
splitButtonChecked = false,
splitButtonProps,
floatingButtonProps,
style,
text,
theme,
Expand Down Expand Up @@ -81,7 +81,7 @@ export const BaseButton: FC<InternalButtonProps> = React.forwardRef(
{ [styles.buttonSize2]: size === ButtonSize.Medium },
{ [styles.buttonSize3]: size === ButtonSize.Small },
{ [styles.pillShape]: shape === ButtonShape.Pill },
{ [styles.roundShape]: shape === ButtonShape.Round },
{ [styles.roundShape]: shape === ButtonShape.Round && !split },
{ [styles.dropShadow]: dropShadow },
{ [styles.dark]: theme === ButtonTheme.dark },
{ [styles.floating]: floatingButtonProps?.enabled },
Expand Down
8 changes: 4 additions & 4 deletions src/components/Button/Button.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ export interface ButtonProps extends NativeButtonProps {
* @default false
*/
dropShadow?: boolean;
/**
* The button is always floating on bottom right corner.
*/
floatingButtonProps?: FloatingButtonProps;
/**
* The button html type.
*/
Expand Down Expand Up @@ -202,8 +206,4 @@ export interface ButtonProps extends NativeButtonProps {
* The button is a toggle button with distinct on and off states.
*/
toggle?: boolean;
/**
* The button is always floating on bottom right corner.
*/
floatingButtonProps?: FloatingButtonProps;
}
4 changes: 3 additions & 1 deletion src/components/Button/DefaultButton/DefaultButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const DefaultButton: FC<ButtonProps> = React.forwardRef(
counter,
disabled = false,
dropShadow = false,
floatingButtonProps,
htmlType,
iconProps,
onClick,
Expand Down Expand Up @@ -62,6 +63,7 @@ export const DefaultButton: FC<ButtonProps> = React.forwardRef(
counter={counter}
disabled={disabled}
dropShadow={dropShadow}
floatingButtonProps={floatingButtonProps}
htmlType={htmlType}
iconProps={iconProps}
onClick={onClick}
Expand All @@ -73,8 +75,8 @@ export const DefaultButton: FC<ButtonProps> = React.forwardRef(
style={style}
text={text}
theme={theme}
type={ButtonType.Default}
toggle={toggle}
type={ButtonType.Default}
buttonWidth={buttonWidth}
/>
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/Button/NeutralButton/NeutralButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const NeutralButton: FC<ButtonProps> = React.forwardRef(
counter,
disabled = false,
dropShadow = false,
floatingButtonProps,
htmlType,
iconProps,
onClick,
Expand Down Expand Up @@ -60,6 +61,7 @@ export const NeutralButton: FC<ButtonProps> = React.forwardRef(
counter={counter}
disabled={disabled}
dropShadow={dropShadow}
floatingButtonProps={floatingButtonProps}
htmlType={htmlType}
iconProps={iconProps}
onClick={onClick}
Expand All @@ -71,8 +73,8 @@ export const NeutralButton: FC<ButtonProps> = React.forwardRef(
style={style}
text={text}
theme={theme}
type={ButtonType.Neutral}
toggle={toggle}
type={ButtonType.Neutral}
buttonWidth={buttonWidth}
/>
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/Button/PrimaryButton/PrimaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const PrimaryButton: FC<ButtonProps> = React.forwardRef(
disabled = false,
disruptive = false,
dropShadow = false,
floatingButtonProps,
htmlType,
iconProps,
onClick,
Expand Down Expand Up @@ -61,23 +62,24 @@ export const PrimaryButton: FC<ButtonProps> = React.forwardRef(
checked={checked}
classNames={buttonClassNames}
counter={counter}
splitButtonChecked={splitButtonChecked}
disabled={disabled}
disruptive={disruptive}
dropShadow={dropShadow}
floatingButtonProps={floatingButtonProps}
htmlType={htmlType}
iconProps={iconProps}
onClick={onClick}
onContextMenu={onContextMenu}
shape={shape}
size={size}
split={split}
splitButtonChecked={splitButtonChecked}
splitButtonProps={splitButtonProps}
style={style}
text={text}
theme={theme}
type={ButtonType.Primary}
toggle={toggle}
type={ButtonType.Primary}
buttonWidth={buttonWidth}
/>
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/Button/SecondaryButton/SecondaryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const SecondaryButton: FC<ButtonProps> = React.forwardRef(
disabled = false,
disruptive = false,
dropShadow = false,
floatingButtonProps,
htmlType,
iconProps,
onClick,
Expand Down Expand Up @@ -63,6 +64,7 @@ export const SecondaryButton: FC<ButtonProps> = React.forwardRef(
disabled={disabled}
disruptive={disruptive}
dropShadow={dropShadow}
floatingButtonProps={floatingButtonProps}
htmlType={htmlType}
iconProps={iconProps}
onClick={onClick}
Expand All @@ -74,8 +76,8 @@ export const SecondaryButton: FC<ButtonProps> = React.forwardRef(
style={style}
text={text}
theme={theme}
type={ButtonType.Secondary}
toggle={toggle}
type={ButtonType.Secondary}
buttonWidth={buttonWidth}
/>
);
Expand Down

0 comments on commit 62873cb

Please sign in to comment.