From 019227824124558fc3335f107e43077bdf590c4d Mon Sep 17 00:00:00 2001 From: veselovnk Date: Sat, 27 Apr 2024 16:27:25 +0300 Subject: [PATCH] MSP-3203 create ActiveTableActionsButtons --- .../active-table-action-buttons.scss | 12 ++ .../active-table-action-buttons.type.ts | 10 ++ .../ActiveTableActionButtons/index.tsx | 108 ++++++++++++++++++ 3 files changed, 130 insertions(+) create mode 100644 src/widgets/ActiveTableActionButtons/active-table-action-buttons.scss create mode 100644 src/widgets/ActiveTableActionButtons/active-table-action-buttons.type.ts create mode 100644 src/widgets/ActiveTableActionButtons/index.tsx diff --git a/src/widgets/ActiveTableActionButtons/active-table-action-buttons.scss b/src/widgets/ActiveTableActionButtons/active-table-action-buttons.scss new file mode 100644 index 0000000..6fef769 --- /dev/null +++ b/src/widgets/ActiveTableActionButtons/active-table-action-buttons.scss @@ -0,0 +1,12 @@ +@import "src/constants/style/styleConst"; + + +.active-configurations-table-actions-field { + display: flex; + gap: $basic-margin; +} + +.dropdown { + display: flex; + gap: $basic-margin; +} diff --git a/src/widgets/ActiveTableActionButtons/active-table-action-buttons.type.ts b/src/widgets/ActiveTableActionButtons/active-table-action-buttons.type.ts new file mode 100644 index 0000000..43a4109 --- /dev/null +++ b/src/widgets/ActiveTableActionButtons/active-table-action-buttons.type.ts @@ -0,0 +1,10 @@ +import { ConfigType } from '@pages/ModulesPage/module.type.ts' + +export interface ActiveTableActionButtonsPropsType { + isActive: boolean + record: ConfigType + handleShowConfig: (record: ConfigType) => void + handleShowCompareModal: (record: ConfigType) => void + handleDeleteConfig: (record: ConfigType) => void + handleMarkConfigActive: (record: ConfigType) => void +} diff --git a/src/widgets/ActiveTableActionButtons/index.tsx b/src/widgets/ActiveTableActionButtons/index.tsx new file mode 100644 index 0000000..ac93c13 --- /dev/null +++ b/src/widgets/ActiveTableActionButtons/index.tsx @@ -0,0 +1,108 @@ +import { + AlertOutlined, + DeleteOutlined, + EditOutlined, + EyeOutlined, + HistoryOutlined, + SwapOutlined +} from '@ant-design/icons' +import { Button, Dropdown, Popconfirm, Tooltip } from 'antd' +import { FC } from 'react' +import { useNavigate } from 'react-router-dom' + +import { ActiveTableActionButtonsPropsType } from './active-table-action-buttons.type.ts' + +import './active-table-action-buttons.scss' +import CanEdit from '@components/CanEdit' + +const ActiveTableActionButtons: FC = + ({ + isActive, + record, + handleShowCompareModal, + handleShowConfig, + handleDeleteConfig, + handleMarkConfigActive + }) => { + const navigate = useNavigate() + + const navigateToAllVersion = () => navigate(`${record.id}/all_versions`) + + const renderDropDown = (record: any) => { + return ( +
+ +
+ ) + } + + const renderAdditionalButtons = () => { + if (isActive) { + return ( + <> + + + + + ) + } + return ( +
+ +
+ ) + } + +export default ActiveTableActionButtons