tianji/src/client/components/CommonHeader.tsx

30 lines
809 B
TypeScript
Raw Normal View History

2024-03-23 11:38:39 +00:00
import React from 'react';
2024-03-25 13:53:43 +00:00
import { TipIcon } from './TipIcon';
2024-03-23 11:38:39 +00:00
interface CommonHeaderProps {
title: string;
2024-04-01 16:07:38 +00:00
desc?: string;
tip?: React.ReactNode;
2024-03-23 11:38:39 +00:00
actions?: React.ReactNode;
}
export const CommonHeader: React.FC<CommonHeaderProps> = React.memo((props) => {
return (
2024-04-01 16:07:38 +00:00
<div className="flex w-full items-center">
<div className="flex flex-1 items-center">
<h1 className="text-xl font-bold">{props.title}</h1>
2024-03-23 11:38:39 +00:00
2024-04-01 16:07:38 +00:00
{props.desc && (
<span className="text-muted-foreground ml-2 self-end text-sm">
{props.desc}
</span>
)}
{props.tip && <TipIcon className="ml-1" content={props.tip} />}
</div>
2024-03-25 13:53:43 +00:00
2024-03-23 11:38:39 +00:00
{props.actions && <div className="ml-auto">{props.actions}</div>}
2024-04-01 16:07:38 +00:00
</div>
2024-03-23 11:38:39 +00:00
);
});
CommonHeader.displayName = 'CommonHeader';