MCPcopy
hub / github.com/puckeditor/puck / ComponentListItem

Function ComponentListItem

packages/core/components/ComponentList/index.tsx:10–40  ·  view source on GitHub ↗
({
  name,
  label,
}: {
  name: string;
  label?: string;
  index?: number; // TODO deprecate
})

Source from the content-addressed store, hash-verified

8const getClassName = getClassNameFactory("ComponentList", styles);
9
10const ComponentListItem = ({
11 name,
12 label,
13}: {
14 name: string;
15 label?: string;
16 index?: number; // TODO deprecate
17}) => {
18 const overrides = useAppStore((s) => s.overrides);
19 const canInsert = useAppStore(
20 (s) =>
21 s.permissions.getPermissions({
22 type: name,
23 }).insert
24 );
25
26 // DEPRECATED
27 useEffect(() => {
28 if (overrides.componentItem) {
29 console.warn(
30 "The `componentItem` override has been deprecated and renamed to `drawerItem`"
31 );
32 }
33 }, [overrides]);
34
35 return (
36 <Drawer.Item label={label} name={name} isDragDisabled={!canInsert}>
37 {overrides.componentItem ?? overrides.drawerItem}
38 </Drawer.Item>
39 );
40};
41
42const ComponentList = ({
43 children,

Callers

nothing calls this directly

Calls 1

useAppStoreFunction · 0.90

Tested by

no test coverage detected