2022-11-09 21:38:05 -05:00
|
|
|
import { Popover, Button } from "@geist-ui/core/dist"
|
2022-04-20 02:36:56 -04:00
|
|
|
import { MoreVertical } from "@geist-ui/icons"
|
|
|
|
|
|
|
|
type Action = {
|
2022-04-22 01:01:59 -04:00
|
|
|
title: string
|
|
|
|
onClick: () => void
|
2022-04-20 02:36:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
const ActionDropdown = ({
|
2022-04-22 01:01:59 -04:00
|
|
|
title = "Actions",
|
|
|
|
actions,
|
|
|
|
showTitle = false
|
2022-04-20 02:36:56 -04:00
|
|
|
}: {
|
2022-04-22 01:01:59 -04:00
|
|
|
title?: string
|
|
|
|
showTitle?: boolean
|
|
|
|
actions: Action[]
|
2022-04-20 02:36:56 -04:00
|
|
|
}) => {
|
2022-04-22 01:01:59 -04:00
|
|
|
return (
|
|
|
|
<Popover
|
|
|
|
title={title}
|
|
|
|
content={
|
|
|
|
<>
|
|
|
|
{showTitle && <Popover.Item title>{title}</Popover.Item>}
|
|
|
|
{actions.map((action) => (
|
|
|
|
<Popover.Item onClick={action.onClick} key={action.title}>
|
|
|
|
{action.title}
|
|
|
|
</Popover.Item>
|
|
|
|
))}
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
hideArrow
|
|
|
|
>
|
|
|
|
<Button iconRight={<MoreVertical />} auto></Button>
|
|
|
|
</Popover>
|
|
|
|
)
|
2022-04-20 02:36:56 -04:00
|
|
|
}
|
|
|
|
|
2022-04-22 01:01:59 -04:00
|
|
|
export default ActionDropdown
|