MCPcopy Create free account
hub / github.com/code-with-antonio/nodebase / EntityHeader

Function EntityHeader

src/components/entity-components.tsx:39–81  ·  view source on GitHub ↗
({
  title,
  description,
  onNew,
  newButtonHref,
  newButtonLabel,
  disabled,
  isCreating,
}: EntityHeaderProps)

Source from the content-addressed store, hash-verified

37);
38
39export const EntityHeader = ({
40 title,
41 description,
42 onNew,
43 newButtonHref,
44 newButtonLabel,
45 disabled,
46 isCreating,
47}: EntityHeaderProps) => {
48 return (
49 <div className="flex flex-row items-center justify-between gap-x-4">
50 <div className="flex flex-col">
51 <h1 className="text-lg md:text-xl font-semibold">{title}</h1>
52 {description && (
53 <p className="text-xs md:text-sm text-muted-foreground">
54 {description}
55 </p>
56 )}
57 </div>
58 {onNew && !newButtonHref && (
59 <Button
60 disabled={isCreating || disabled}
61 size="sm"
62 onClick={onNew}
63 >
64 <PlusIcon className="size-4" />
65 {newButtonLabel}
66 </Button>
67 )}
68 {newButtonHref && !onNew && (
69 <Button
70 size="sm"
71 asChild
72 >
73 <Link href={newButtonHref} prefetch>
74 <PlusIcon className="size-4" />
75 {newButtonLabel}
76 </Link>
77 </Button>
78 )}
79 </div>
80 );
81};
82
83type EntityContainerProps = {
84 children: React.ReactNode;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected