From 68b4c97b44a08037a46597614340ab37cb8e6f48 Mon Sep 17 00:00:00 2001 From: calaquend1 Date: Fri, 3 Mar 2023 13:00:21 +0400 Subject: [PATCH 1/6] feat: add actions button size control prop --- src/components/Table/__stories__/Table.stories.tsx | 2 +- .../Table/hoc/withTableActions/withTableActions.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/Table/__stories__/Table.stories.tsx b/src/components/Table/__stories__/Table.stories.tsx index c4f871a4d..f7127d1dc 100644 --- a/src/components/Table/__stories__/Table.stories.tsx +++ b/src/components/Table/__stories__/Table.stories.tsx @@ -112,7 +112,7 @@ const WithTableActionsTemplate: Story> = (args) => { }, }, ]; - return ; + return ; }; export const HOCWithTableActions = WithTableActionsTemplate.bind({}); diff --git a/src/components/Table/hoc/withTableActions/withTableActions.tsx b/src/components/Table/hoc/withTableActions/withTableActions.tsx index 3d4f10b61..ab71e0510 100644 --- a/src/components/Table/hoc/withTableActions/withTableActions.tsx +++ b/src/components/Table/hoc/withTableActions/withTableActions.tsx @@ -3,7 +3,7 @@ import _memoize from 'lodash/memoize'; import {block} from '../../../utils/cn'; import {getComponentName} from '../../../utils/getComponentName'; import {Icon} from '../../../Icon'; -import {Button} from '../../../Button'; +import {Button, ButtonSize} from '../../../Button'; import {Popup} from '../../../Popup'; import {Menu, MenuItemProps} from '../../../Menu'; import {DotsIcon} from '../../../icons/DotsIcon'; @@ -54,6 +54,7 @@ export type TableActionConfig = TableAction | TableActionGroup; export interface WithTableActionsProps { getRowActions: (item: I, index: number) => TableActionConfig[]; + actionsButtonSize?: ButtonSize; } interface WithTableActionsState { @@ -105,7 +106,7 @@ export function withTableActions( } private renderBodyCell = (item: I, index: number) => { - const {isRowDisabled, getRowActions} = this.props; + const {isRowDisabled, getRowActions, actionsButtonSize} = this.props; const actions = getRowActions(item, index); if (actions.length === 0) { @@ -121,6 +122,7 @@ export function withTableActions( disabled={disabled} className={BUTTON_CLASSNAME} onClick={this.handleActionsButtonClick.bind(this, {item, index})} + size={actionsButtonSize} > From 65e446c70df32960ee12b55154f9c13adc6af0c0 Mon Sep 17 00:00:00 2001 From: calaquend1 Date: Fri, 3 Mar 2023 15:03:18 +0400 Subject: [PATCH 2/6] feat: add dropdown menu rowactionssize prop --- src/components/DropdownMenu/DropdownMenu.tsx | 6 ++++-- .../__stories__/DropdownMenu.stories.tsx | 14 +++++++------- src/components/Table/__stories__/Table.stories.tsx | 2 +- .../hoc/withTableActions/withTableActions.tsx | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/components/DropdownMenu/DropdownMenu.tsx b/src/components/DropdownMenu/DropdownMenu.tsx index 3f08ea1c1..52eac565b 100644 --- a/src/components/DropdownMenu/DropdownMenu.tsx +++ b/src/components/DropdownMenu/DropdownMenu.tsx @@ -2,7 +2,7 @@ import React, {useRef, useMemo} from 'react'; import type {ReactNode, MouseEventHandler, Dispatch, SetStateAction} from 'react'; import type {PopupProps} from '../Popup'; -import {Button} from '../Button'; +import {Button, ButtonSize} from '../Button'; import type {ButtonProps} from '../Button'; import {Icon} from '../Icon'; import {DotsIcon} from '../icons'; @@ -72,6 +72,7 @@ export type DropdownMenuProps = { * Overrides the default dropdown popup props. */ popupProps?: Partial; + rowActionsSize?: ButtonSize; /** * Custom content inside the menu popup. */ @@ -100,6 +101,7 @@ const DropdownMenu = ({ menuProps, popupProps, children, + rowActionsSize, }: DropdownMenuProps | ControlledDropdownMenuProps) => { const anchorRef = useRef(null); @@ -144,7 +146,7 @@ const DropdownMenu = ({ {switcher || ( From 8d7f27106f6cc4450138941015a8390175485865 Mon Sep 17 00:00:00 2001 From: calaquend1 Date: Fri, 3 Mar 2023 15:59:20 +0400 Subject: [PATCH 3/6] feat: remove size from dropdown menu, add size to menu in popup --- src/components/DropdownMenu/DropdownMenu.tsx | 6 ++---- .../__stories__/DropdownMenu.stories.tsx | 14 +++++++------- src/components/Table/__stories__/Table.stories.tsx | 2 +- .../hoc/withTableActions/withTableActions.tsx | 6 ++++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/DropdownMenu/DropdownMenu.tsx b/src/components/DropdownMenu/DropdownMenu.tsx index 52eac565b..3f08ea1c1 100644 --- a/src/components/DropdownMenu/DropdownMenu.tsx +++ b/src/components/DropdownMenu/DropdownMenu.tsx @@ -2,7 +2,7 @@ import React, {useRef, useMemo} from 'react'; import type {ReactNode, MouseEventHandler, Dispatch, SetStateAction} from 'react'; import type {PopupProps} from '../Popup'; -import {Button, ButtonSize} from '../Button'; +import {Button} from '../Button'; import type {ButtonProps} from '../Button'; import {Icon} from '../Icon'; import {DotsIcon} from '../icons'; @@ -72,7 +72,6 @@ export type DropdownMenuProps = { * Overrides the default dropdown popup props. */ popupProps?: Partial; - rowActionsSize?: ButtonSize; /** * Custom content inside the menu popup. */ @@ -101,7 +100,6 @@ const DropdownMenu = ({ menuProps, popupProps, children, - rowActionsSize, }: DropdownMenuProps | ControlledDropdownMenuProps) => { const anchorRef = useRef(null); @@ -146,7 +144,7 @@ const DropdownMenu = ({ {switcher || (