Create stories for action display components (#11547)
Create stories for: - ActionButton - ActionComponent - ActionDisplay - ActionDropdownItem - ActionListItem
This commit is contained in:
@ -1,20 +1,30 @@
|
||||
import { Action } from '@/action-menu/actions/components/Action';
|
||||
import { ActionLink } from '@/action-menu/actions/components/ActionLink';
|
||||
import { NoSelectionRecordActionKeys } from '@/action-menu/actions/record-actions/no-selection/types/NoSelectionRecordActionsKeys';
|
||||
import { SingleRecordActionKeys } from '@/action-menu/actions/record-actions/single-record/types/SingleRecordActionsKey';
|
||||
import { ActionConfig } from '@/action-menu/actions/types/ActionConfig';
|
||||
import { ActionScope } from '@/action-menu/actions/types/ActionScope';
|
||||
import { ActionType } from '@/action-menu/actions/types/ActionType';
|
||||
import { ActionViewType } from '@/action-menu/actions/types/ActionViewType';
|
||||
import { CoreObjectNamePlural } from '@/object-metadata/types/CoreObjectNamePlural';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { IconFileExport, IconHeart, IconTrash } from 'twenty-ui/display';
|
||||
import {
|
||||
IconFileExport,
|
||||
IconHeart,
|
||||
IconTrash,
|
||||
IconUser,
|
||||
} from 'twenty-ui/display';
|
||||
|
||||
export const createMockActionMenuActions = ({
|
||||
deleteMock,
|
||||
addToFavoritesMock,
|
||||
exportMock,
|
||||
deleteMock = () => {},
|
||||
addToFavoritesMock = () => {},
|
||||
exportMock = () => {},
|
||||
}: {
|
||||
deleteMock: () => void;
|
||||
addToFavoritesMock: () => void;
|
||||
exportMock: () => void;
|
||||
deleteMock?: () => void;
|
||||
addToFavoritesMock?: () => void;
|
||||
exportMock?: () => void;
|
||||
}): ActionConfig[] => [
|
||||
{
|
||||
type: ActionType.Standard,
|
||||
@ -66,4 +76,30 @@ export const createMockActionMenuActions = ({
|
||||
],
|
||||
component: <Action onClick={deleteMock} />,
|
||||
},
|
||||
{
|
||||
type: ActionType.Navigation,
|
||||
scope: ActionScope.Global,
|
||||
key: NoSelectionRecordActionKeys.GO_TO_PEOPLE,
|
||||
label: msg`Go to People`,
|
||||
shortLabel: msg`People`,
|
||||
position: 19,
|
||||
Icon: IconUser,
|
||||
isPinned: false,
|
||||
availableOn: [
|
||||
ActionViewType.INDEX_PAGE_NO_SELECTION,
|
||||
ActionViewType.INDEX_PAGE_SINGLE_RECORD_SELECTION,
|
||||
ActionViewType.INDEX_PAGE_BULK_SELECTION,
|
||||
ActionViewType.SHOW_PAGE,
|
||||
],
|
||||
shouldBeRegistered: ({ objectMetadataItem, viewType }) =>
|
||||
objectMetadataItem?.nameSingular !== CoreObjectNameSingular.Person ||
|
||||
viewType === ActionViewType.SHOW_PAGE,
|
||||
component: (
|
||||
<ActionLink
|
||||
to={AppPath.RecordIndexPage}
|
||||
params={{ objectNamePlural: CoreObjectNamePlural.Person }}
|
||||
/>
|
||||
),
|
||||
hotKeys: ['G', 'P'],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user