feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)
This commit is contained in:
committed by
GitHub
parent
d6b1ad1ccd
commit
40de54b010
@@ -0,0 +1,55 @@
|
||||
import * as DropdownMenu from "@radix-ui/react-dropdown-menu"
|
||||
import React from "react"
|
||||
import Button from "../../fundamentals/button"
|
||||
import StatusIndicator from "../../fundamentals/status-indicator"
|
||||
|
||||
type StatusSelectorProps = {
|
||||
isDraft: boolean
|
||||
activeState: string
|
||||
draftState: string
|
||||
onChange: () => void
|
||||
}
|
||||
|
||||
const StatusSelector: React.FC<StatusSelectorProps> = ({
|
||||
isDraft,
|
||||
draftState,
|
||||
activeState,
|
||||
onChange,
|
||||
}) => {
|
||||
return (
|
||||
<div>
|
||||
<DropdownMenu.Root>
|
||||
<DropdownMenu.Trigger asChild>
|
||||
<Button variant="ghost" size="small">
|
||||
<StatusIndicator
|
||||
title={isDraft ? draftState : activeState}
|
||||
variant={isDraft ? "default" : "active"}
|
||||
/>
|
||||
</Button>
|
||||
</DropdownMenu.Trigger>
|
||||
<DropdownMenu.Content
|
||||
sideOffset={5}
|
||||
className="border bg-grey-0 border-grey-20 rounded-rounded shadow-dropdown p-xsmall min-w-[200px] z-30"
|
||||
>
|
||||
<DropdownMenu.Item>
|
||||
{
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="small"
|
||||
className="w-full justify-start"
|
||||
onClick={onChange}
|
||||
>
|
||||
<StatusIndicator
|
||||
title={!isDraft ? draftState : activeState}
|
||||
variant={!isDraft ? "default" : "active"}
|
||||
/>
|
||||
</Button>
|
||||
}
|
||||
</DropdownMenu.Item>
|
||||
</DropdownMenu.Content>
|
||||
</DropdownMenu.Root>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default StatusSelector
|
||||
Reference in New Issue
Block a user