Phase 5 cleanup
This commit is contained in:
parent
5536acd67d
commit
76a516a417
136 changed files with 6322 additions and 1985 deletions
41
packages/web/src/components/layout/SetPageHeader.tsx
Normal file
41
packages/web/src/components/layout/SetPageHeader.tsx
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
'use client';
|
||||
|
||||
import { useEffect, type ReactNode } from 'react';
|
||||
import { usePageHeader } from './PageHeaderContext';
|
||||
|
||||
interface SetPageHeaderProps {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
crumbs?: string[];
|
||||
actions?: ReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call inside a page component to set the TopBar's title/subtitle/crumbs.
|
||||
* Renders a visually-hidden heading for accessibility and tests.
|
||||
*/
|
||||
export function SetPageHeader({ title, subtitle, crumbs, actions }: SetPageHeaderProps) {
|
||||
const { setHeader } = usePageHeader();
|
||||
useEffect(() => {
|
||||
setHeader({ title, subtitle, crumbs, actions });
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [title, subtitle, crumbs?.join(',')]);
|
||||
return (
|
||||
<h1
|
||||
aria-hidden="false"
|
||||
style={{
|
||||
position: 'absolute',
|
||||
width: 1,
|
||||
height: 1,
|
||||
padding: 0,
|
||||
margin: -1,
|
||||
overflow: 'hidden',
|
||||
clip: 'rect(0,0,0,0)',
|
||||
whiteSpace: 'nowrap',
|
||||
border: 0,
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue