Skip to content

Commit

Permalink
Add small button styling
Browse files Browse the repository at this point in the history
  • Loading branch information
filip-solecki committed Aug 27, 2024
1 parent 0f7b3f8 commit 2d9c4e9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3902,6 +3902,7 @@ const CONST = {
DROPDOWN_BUTTON_SIZE: {
LARGE: 'large',
MEDIUM: 'medium',
SMALL: 'small',
},

SF_COORDINATES: [-122.4194, 37.7749],
Expand Down
5 changes: 3 additions & 2 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ function Button(
<Icon
src={iconRight}
fill={isHovered ? iconHoverFill ?? defaultFill : iconFill ?? defaultFill}
small={medium}
medium={large}
small={small}
medium={medium}
large={large}
/>
) : (
<Icon
Expand Down
15 changes: 9 additions & 6 deletions src/components/ButtonWithDropdownMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,9 @@ function ButtonWithDropdownMenu<IValueType>({
isLoading={isLoading}
shouldRemoveRightBorderRadius
style={[styles.flex1, styles.pr0]}
large={isButtonSizeLarge}
medium={!isButtonSizeLarge}
large={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.LARGE}
medium={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.MEDIUM}
small={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.SMALL}
innerStyles={[innerStyleDropButton, !isSplitButton && styles.dropDownButtonCartIconView]}
enterKeyEventListenerPriority={enterKeyEventListenerPriority}
iconRight={Expensicons.DownArrow}
Expand All @@ -129,8 +130,9 @@ function ButtonWithDropdownMenu<IValueType>({
style={[styles.pl0]}
onPress={() => setIsMenuVisible(!isMenuVisible)}
shouldRemoveLeftBorderRadius
large={isButtonSizeLarge}
medium={!isButtonSizeLarge}
large={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.LARGE}
medium={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.MEDIUM}
small={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.SMALL}
innerStyles={[styles.dropDownButtonCartIconContainerPadding, innerStyleDropButton]}
enterKeyEventListenerPriority={enterKeyEventListenerPriority}
>
Expand Down Expand Up @@ -158,8 +160,9 @@ function ButtonWithDropdownMenu<IValueType>({
isLoading={isLoading}
text={selectedItem.text}
onPress={(event) => onPress(event, options[0].value)}
large={isButtonSizeLarge}
medium={!isButtonSizeLarge}
large={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.LARGE}
medium={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.MEDIUM}
small={buttonSize === CONST.DROPDOWN_BUTTON_SIZE.SMALL}
innerStyles={[innerStyleDropButton]}
enterKeyEventListenerPriority={enterKeyEventListenerPriority}
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/ImportColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ function ImportColumn({column, containsHeader, columnName, columnRoles, columnIn
<View style={styles.ml2}>
<ButtonWithDropdownMenu
onPress={() => {}}
buttonSize={CONST.DROPDOWN_BUTTON_SIZE.SMALL}
shouldShowSelectedItemCheck
menuHeaderText={columnHeader}
isSplitButton={false}
Expand Down
7 changes: 7 additions & 0 deletions src/styles/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,13 @@ function getDropDownButtonHeight(buttonSize: ButtonSizeValue): ViewStyle {
height: variables.componentSizeLarge,
};
}

if (buttonSize === CONST.DROPDOWN_BUTTON_SIZE.SMALL) {
return {
height: variables.componentSizeSmall,
};
}

return {
height: variables.componentSizeNormal,
};
Expand Down

0 comments on commit 2d9c4e9

Please sign in to comment.