-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
495 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...layout/project/sidebar/scenario/grid-setup/features/target-spf/bulk-action-menu/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { useCallback, useState } from 'react'; | ||
|
||
import Button from 'components/button'; | ||
import Icon from 'components/icon'; | ||
import Modal from 'components/modal/component'; | ||
import DeleteModal from 'layout/project/sidebar/project/inventory-panel/features/modals/delete'; | ||
import { Feature } from 'types/api/feature'; | ||
|
||
import DELETE_SVG from 'svgs/ui/new-layout/delete.svg?sprite'; | ||
|
||
const BUTTON_CLASSES = | ||
'col-span-1 flex items-center space-x-2 rounded-lg bg-gray-800 px-4 text-xs text-gray-100'; | ||
const ICON_CLASSES = 'h-5 w-5 transition-colors text-gray-100 group-hover:text-gray-100'; | ||
|
||
const SplitFeaturesBulkActionMenu = ({ | ||
selectedFeatureIds, | ||
}: { | ||
selectedFeatureIds: Feature['id'][]; | ||
}): JSX.Element => { | ||
const [modalState, setModalState] = useState<{ edit: boolean; delete: boolean }>({ | ||
edit: false, | ||
delete: false, | ||
}); | ||
|
||
const handleModal = useCallback((modalKey: keyof typeof modalState, isVisible: boolean) => { | ||
setModalState((prevState) => ({ ...prevState, [modalKey]: isVisible })); | ||
}, []); | ||
|
||
return ( | ||
<> | ||
<div className="grid w-full grid-cols-2 items-center space-x-2 rounded-xl bg-gray-600 p-1"> | ||
<span className="col-span-1 flex items-center justify-center space-x-2"> | ||
<span className="block w-[20px] rounded-[4px] bg-blue-500/25 px-1 text-center text-xs font-semibold text-blue-500"> | ||
{selectedFeatureIds.length} | ||
</span> | ||
<span className="text-xs text-gray-100">Selected</span> | ||
</span> | ||
|
||
<Button | ||
theme="secondary" | ||
size="base" | ||
className={BUTTON_CLASSES} | ||
onClick={() => handleModal('delete', true)} | ||
> | ||
<Icon icon={DELETE_SVG} className={ICON_CLASSES} /> | ||
<span>Delete</span> | ||
</Button> | ||
</div> | ||
|
||
<Modal | ||
id="delete-split-features-modal" | ||
open={modalState.delete} | ||
size="narrow" | ||
dismissable | ||
onDismiss={() => handleModal('delete', false)} | ||
> | ||
<DeleteModal selectedFeaturesIds={selectedFeatureIds} /> | ||
</Modal> | ||
</> | ||
); | ||
}; | ||
|
||
export default SplitFeaturesBulkActionMenu; |
Oops, something went wrong.