mirror of
https://github.com/zhigang1992/react.git
synced 2026-01-28 22:30:13 +08:00
20 lines
422 B
TypeScript
20 lines
422 B
TypeScript
import React from 'react'
|
|
import Head from 'next/head'
|
|
|
|
export interface Meta {
|
|
title: string
|
|
}
|
|
|
|
const toCapitalize = (name: string) => {
|
|
const [first, ...rest] = name
|
|
return `${first.toUpperCase()}${rest.join('')}`
|
|
}
|
|
|
|
const PageHeader: React.FC<{ meta: Meta }> = ({ meta }) => (
|
|
<Head>
|
|
<title>{meta.title ? `${toCapitalize(meta.title)} | ` : ''}React - Geist UI</title>
|
|
</Head>
|
|
)
|
|
|
|
export default PageHeader
|