diff --git a/decide/administration/frontend/src/components/03-organisms/Actions/actionBar.tsx b/decide/administration/frontend/src/components/03-organisms/Actions/actionBar.tsx new file mode 100644 index 0000000000..8a53803ba2 --- /dev/null +++ b/decide/administration/frontend/src/components/03-organisms/Actions/actionBar.tsx @@ -0,0 +1,60 @@ +import React, { ReactElement } from "react"; + +import { Box } from "@mui/system"; +import { Divider } from "@mui/material"; +import { IconButton } from "components/01-atoms"; + +type Action = { + title: string; + icon: ReactElement; + onClick?: () => void; +}; + +const Component = (props: { + selection?: any[]; + actions?: ReactElement[]; + selectedActions?: Action[]; + bulkActions?: Action[]; +}) => { + const individualEnabled = React.useMemo( + () => props.selection && props.selection?.length === 1, + [props.selection] + ); + const bulkEnabled = React.useMemo( + () => props.selection && props.selection.length >= 1, + [props.selection] + ); + + return ( + + + {props.actions} + + {props.selectedActions?.map((action, index) => ( + + ))} + + {props.bulkActions?.map((action, index) => ( + + ))} + + + ); +}; + +export default Component; diff --git a/decide/administration/frontend/src/components/03-organisms/Actions/index.ts b/decide/administration/frontend/src/components/03-organisms/Actions/index.ts new file mode 100644 index 0000000000..97acd74418 --- /dev/null +++ b/decide/administration/frontend/src/components/03-organisms/Actions/index.ts @@ -0,0 +1,3 @@ +import ActionBar from "./actionBar"; + +export { ActionBar };