Skip to content

Commit 1d4a057

Browse files
committed
feat(header): support extra child components
1 parent c4dc102 commit 1d4a057

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/components/Page/Header.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1+
import React, { ReactChild } from 'react';
12
import { Link } from 'react-router-dom';
2-
import React from 'react';
33

44
interface HeaderProps {
55
title: string;
66
button?: string;
77
navTo?: string;
8+
extraContent?: ReactChild;
89
}
910

10-
const Header: React.FC<HeaderProps> = ({ title, button, navTo }) => {
11+
const Header: React.FC<HeaderProps> = ({
12+
title,
13+
button,
14+
navTo,
15+
extraContent,
16+
}) => {
1117
const isButtonNeeded = button !== undefined && navTo !== undefined;
1218

1319
return (
@@ -40,6 +46,9 @@ const Header: React.FC<HeaderProps> = ({ title, button, navTo }) => {
4046
<h1 className="text-3xl dark:text-white font-bold text-gray-900 ml-2">
4147
{title}
4248
</h1>
49+
{/* Add space to move extraContent to the end of the header */}
50+
<div className="flex-grow"></div>
51+
{extraContent}
4352
</div>
4453
) : (
4554
<div className="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8 flex justify-between">

0 commit comments

Comments
 (0)