refactor(ui): extract reusable component package
This commit is contained in:
parent
87261b5a3f
commit
2664804e91
86 changed files with 102 additions and 85 deletions
30
packages/ui/src/components/DashboardHeader.tsx
Normal file
30
packages/ui/src/components/DashboardHeader.tsx
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { useId } from "react";
|
||||
import type { UiModuleBlock } from "../types";
|
||||
import { ModuleCard } from "./ModuleCard";
|
||||
|
||||
export interface DashboardHeaderProps {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
eyebrow?: string;
|
||||
module?: UiModuleBlock;
|
||||
}
|
||||
|
||||
export function DashboardHeader({
|
||||
title,
|
||||
subtitle,
|
||||
eyebrow,
|
||||
module,
|
||||
}: DashboardHeaderProps) {
|
||||
const titleId = useId();
|
||||
|
||||
return (
|
||||
<header className="dashboard-header" aria-labelledby={titleId}>
|
||||
<div>
|
||||
{eyebrow ? <p>{eyebrow}</p> : null}
|
||||
<h1 id={titleId}>{title}</h1>
|
||||
{subtitle ? <span>{subtitle}</span> : null}
|
||||
</div>
|
||||
{module ? <ModuleCard module={module} /> : null}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue