Skip to content

Commit

Permalink
feat: change iconButton name to iconName
Browse files Browse the repository at this point in the history
  • Loading branch information
kostasdano committed Mar 11, 2024
1 parent d4853c2 commit 32a1b14
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/components/ButtonBase/ButtonBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const ButtonBase = React.forwardRef<HTMLButtonElement, ButtonBaseProps>((props,
<div css={buttonWrapperStyle({ isBlock })}>
{isLoading && !isDisabled && <ButtonLoader dataTestId={testIdName} />}
<button
{...omit(rest, ['avatar', 'iconRightName', 'iconLeftName', isIconButton ? 'name' : null])}
{...omit(rest, ['avatar', 'iconRightName', 'iconLeftName', 'iconName'])}
ref={ref}
type={htmlType}
data-testid={generateTestDataId(testIdName, dataTestId)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const MonthWrapper = ({
{(showedArrows === 'left' || showedArrows === 'both') && (
<div css={monthHeaderNavigationIconWrapperStyle({ position: 'left' })}>
<IconButton
name="triangleLeft"
iconName="triangleLeft"
type="tertiary"
onClick={() => handleArrow('back')}
dataTestId="month_back"
Expand Down Expand Up @@ -129,7 +129,7 @@ const MonthWrapper = ({
{(showedArrows === 'right' || showedArrows === 'both') && (
<div css={monthHeaderNavigationIconWrapperStyle({ position: 'right' })}>
<IconButton
name="triangleRight"
iconName="triangleRight"
type="tertiary"
onClick={() => handleArrow('forward')}
dataTestId="month_forward"
Expand Down
4 changes: 2 additions & 2 deletions src/components/DropdownButton/DropdownButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const DropdownButton = React.forwardRef<HTMLButtonElement, DropdownButtonProps>(
<IconButton
type={type}
size={size}
name={iconButtonName}
iconName={iconButtonName}
onClick={handleIconButtonClick}
dataTestPrefixId={generateTestDataId('icon-dropdown', dataTestPrefixId)}
/>
Expand All @@ -119,7 +119,7 @@ const DropdownButton = React.forwardRef<HTMLButtonElement, DropdownButtonProps>(
<IconButton
type={type}
size={size}
name="triangleDown"
iconName="triangleDown"
shape="square"
onClick={handleIconButtonClick}
dataTestPrefixId={generateTestDataId('dropdown-toggle', dataTestPrefixId)}
Expand Down
26 changes: 13 additions & 13 deletions src/components/IconButton/IconButton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ export const IconButtonTypesAndSizes = {
render: () => (
<>
<Stack>
<IconButton name="moreOptions" />
<IconButton name="moreOptions" type="secondary" />
<IconButton name="moreOptions" type="tertiary" />
<IconButton iconName="moreOptions" />
<IconButton iconName="moreOptions" type="secondary" />
<IconButton iconName="moreOptions" type="tertiary" />
</Stack>
<Stack>
<IconButton name="moreOptions" shape="square" />
<IconButton name="moreOptions" type="secondary" shape="square" />
<IconButton name="moreOptions" type="tertiary" shape="square" />
<IconButton iconName="moreOptions" shape="square" />
<IconButton iconName="moreOptions" type="secondary" shape="square" />
<IconButton iconName="moreOptions" type="tertiary" shape="square" />
</Stack>
<Stack>
<IconButton name="moreOptions" size="compact" />
<IconButton name="moreOptions" type="secondary" size="compact" />
<IconButton name="moreOptions" type="tertiary" size="compact" />
<IconButton iconName="moreOptions" size="compact" />
<IconButton iconName="moreOptions" type="secondary" size="compact" />
<IconButton iconName="moreOptions" type="tertiary" size="compact" />
</Stack>
<Stack>
<IconButton name="moreOptions" shape="square" size="compact" />
<IconButton name="moreOptions" type="secondary" shape="square" size="compact" />
<IconButton name="moreOptions" type="tertiary" shape="square" size="compact" />
<IconButton iconName="moreOptions" shape="square" size="compact" />
<IconButton iconName="moreOptions" type="secondary" shape="square" size="compact" />
<IconButton iconName="moreOptions" type="tertiary" shape="square" size="compact" />
</Stack>
</>
),
Expand All @@ -60,7 +60,7 @@ export const Playground = {
render: () => (
<Stack>
<IconButton
name={select(
iconName={select(
'name',
Object.keys(iconSelector)
.sort((a, b) => a.localeCompare(b))
Expand Down
6 changes: 3 additions & 3 deletions src/components/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export type IconButtonProps = Omit<
/** This property defines the type of the IconButton */
type?: PrimitiveButtonTypes;
/** This property defines witch icon to use */
name: AcceptedIconNames;
iconName: AcceptedIconNames;
/** This property defines the shape of the IconButton */
shape?: IconButtonShape;
};

const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>((props, ref) => {
const { name, size = 'normal', type = 'primary', shape = 'circle', dataTestPrefixId } = props;
const { iconName, size = 'normal', type = 'primary', shape = 'circle', dataTestPrefixId } = props;
const theme = useTheme();
const tokens = getButtonTokens(theme);

Expand All @@ -38,7 +38,7 @@ const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>((props,
shape={shape}
dataTestPrefixId={dataTestPrefixId ? `${dataTestPrefixId}-icon-` : 'icon-'}
>
<Icon size={tokens(`${size}.iconSize` as ButtonTokens)} name={name} color={iconColor} />
<Icon size={tokens(`${size}.iconSize` as ButtonTokens)} name={iconName} color={iconColor} />
</ButtonBase>
);
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/Menu/Menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const MenuTriggers = {
return (
<Stack height={400}>
<IconButton
name={'menu'}
iconName={'menu'}
ref={btn1.btnRef}
aria-label="Menu"
onClick={btn1.handleBtnClick}
Expand Down Expand Up @@ -567,7 +567,7 @@ export const MenuDisabledKeys = {
return (
<Stack height={400}>
<IconButton
name={'menu'}
iconName={'menu'}
ref={btn1.btnRef}
aria-label="Menu"
onClick={btn1.handleBtnClick}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const Modal: React.FCC<ModalProps> = ({
<div css={closeContainer}>
<IconButton
type="tertiary"
name="close"
iconName="close"
onClick={onClose}
color={theme.tokens.colors.get('textColor.default.secondary')}
dataTestId="modal-close"
Expand Down
8 changes: 4 additions & 4 deletions src/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ const Pagination = ({
>
{isEnhancedPaginationVisible && (
<IconButton
name="pageFirst"
iconName="pageFirst"
onClick={navigateToFirstPage}
type="tertiary"
isDisabled={isPrevPageDisabled || !hasPrevPage}
/>
)}
<IconButton
name="chevronLeft"
iconName="chevronLeft"
type="tertiary"
onClick={navigateToPrevPage}
isDisabled={isPrevPageDisabled || !hasPrevPage}
Expand All @@ -69,14 +69,14 @@ const Pagination = ({
</div>

<IconButton
name="chevronRight"
iconName="chevronRight"
type="tertiary"
onClick={navigateToNextPage}
isDisabled={isNextPageDisabled || !hasNextPage}
/>
{isEnhancedPaginationVisible && (
<IconButton
name="pageLast"
iconName="pageLast"
type="tertiary"
onClick={navigateToLastPage}
isDisabled={isNextPageDisabled || !hasNextPage}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const ExpandedButtonCell: React.FCC<ExpandedButtonCellProps> = ({
>
<IconButton
type="tertiary"
name="chevronDown"
iconName="chevronDown"
onClick={toggleIsChecked}
dataTestId="expanded-button"
/>
Expand Down

0 comments on commit 32a1b14

Please sign in to comment.