Fix the "Delete" action on the Kaban view (#5646)
# This PR - Fixes #5520 - Created a shared confirmation modal component for the `ContextMenu` and the `ActionBar` components to avoid code repetition - with its storybook file Looking forward to getting feedback @charlesBochet
This commit is contained in:
committed by
GitHub
parent
e9cf449706
commit
520a883c73
@ -0,0 +1,35 @@
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import { IconTrash } from 'twenty-ui';
|
||||
|
||||
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
||||
import SharedNavigationModal from '@/ui/navigation/shared/components/NavigationModal';
|
||||
|
||||
const meta: Meta<typeof SharedNavigationModal> = {
|
||||
title: 'UI/Navigation/Shared/SharedNavigationModal',
|
||||
component: SharedNavigationModal,
|
||||
args: {
|
||||
actionBarEntries: [
|
||||
{
|
||||
ConfirmationModal: (
|
||||
<ConfirmationModal
|
||||
title="Title"
|
||||
deleteButtonText="Delete"
|
||||
onConfirmClick={() => {}}
|
||||
setIsOpen={() => {}}
|
||||
isOpen={false}
|
||||
subtitle="Subtitle"
|
||||
/>
|
||||
),
|
||||
Icon: IconTrash,
|
||||
label: 'Label',
|
||||
onClick: () => {},
|
||||
},
|
||||
],
|
||||
customClassName: 'customClassName',
|
||||
},
|
||||
};
|
||||
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof SharedNavigationModal>;
|
||||
|
||||
export const Default: Story = {};
|
||||
@ -0,0 +1,19 @@
|
||||
import { ActionBarEntry } from '@/ui/navigation/action-bar/types/ActionBarEntry';
|
||||
|
||||
type SharedNavigationModalProps = {
|
||||
actionBarEntries: ActionBarEntry[];
|
||||
customClassName: string;
|
||||
};
|
||||
|
||||
const SharedNavigationModal = ({
|
||||
actionBarEntries,
|
||||
customClassName,
|
||||
}: SharedNavigationModalProps) => {
|
||||
return (
|
||||
<div data-select-disable className={customClassName}>
|
||||
{actionBarEntries[0]?.ConfirmationModal ?? null}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SharedNavigationModal;
|
||||
Reference in New Issue
Block a user