({
title,
description,
onNew,
newButtonHref,
newButtonLabel,
disabled,
isCreating,
}: EntityHeaderProps)
| 37 | ); |
| 38 | |
| 39 | export 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 | |
| 83 | type EntityContainerProps = { |
| 84 | children: React.ReactNode; |
nothing calls this directly
no outgoing calls
no test coverage detected