feat(admin,admin-ui,medusa): Add Medusa Admin plugin (#3334)

This commit is contained in:
Kasper Fabricius Kristensen
2023-03-03 10:09:16 +01:00
committed by GitHub
parent d6b1ad1ccd
commit 40de54b010
928 changed files with 85441 additions and 384 deletions

View File

@@ -0,0 +1,39 @@
import React from "react"
import Checkbox from "../components/atoms/checkbox"
import Table from "../components/molecules/table"
const IndeterminateCheckbox = React.forwardRef(
({ indeterminate, ...rest }, ref) => {
const defaultRef = React.useRef()
const resolvedRef = ref || defaultRef
React.useEffect(() => {
resolvedRef.current.indeterminate = indeterminate
}, [resolvedRef, indeterminate])
return (
<div onClickCapture={(e) => e.stopPropagation()}>
<Checkbox
className="justify-center"
label=""
ref={resolvedRef}
{...rest}
/>
</div>
)
}
)
export const useSelectionColumn = () => {
return {
id: "selection",
Header: ({ getToggleAllRowsSelectedProps }) => (
<IndeterminateCheckbox {...getToggleAllRowsSelectedProps()} />
),
Cell: ({ row }) => (
<Table.Cell className="text-center">
<IndeterminateCheckbox {...row.getToggleRowSelectedProps()} />
</Table.Cell>
),
}
}