mirror of
https://github.com/elastic/kibana.git
synced 2025-06-28 11:05:39 -04:00
* Updating everything except the license headers themselves * Applying ESLint rules * Manually replacing the stragglers
62 lines
1.5 KiB
TypeScript
62 lines
1.5 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
* 2.0; you may not use this file except in compliance with the Elastic License
|
|
* 2.0.
|
|
*/
|
|
|
|
import React from 'react';
|
|
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
|
|
|
import {
|
|
EuiPageBody,
|
|
EuiPageContent,
|
|
EuiPageContentBody,
|
|
EuiPageHeader,
|
|
EuiPageHeaderSection,
|
|
EuiTitle,
|
|
EuiBreadcrumbs,
|
|
EuiSpacer,
|
|
} from '@elastic/eui';
|
|
|
|
type PageProps = RouteComponentProps & {
|
|
title: string;
|
|
children: React.ReactNode;
|
|
crumb?: string;
|
|
isHome?: boolean;
|
|
};
|
|
|
|
export const Page = withRouter(({ title, crumb, children, isHome = false, history }: PageProps) => {
|
|
const breadcrumbs: Array<{
|
|
text: string;
|
|
onClick?: () => void;
|
|
}> = [
|
|
{
|
|
text: crumb ?? title,
|
|
},
|
|
];
|
|
if (!isHome) {
|
|
breadcrumbs.splice(0, 0, {
|
|
text: 'Home',
|
|
onClick: () => {
|
|
history.push(`/`);
|
|
},
|
|
});
|
|
}
|
|
return (
|
|
<EuiPageBody data-test-subj="searchTestPage">
|
|
<EuiPageHeader>
|
|
<EuiPageHeaderSection>
|
|
<EuiTitle size="l">
|
|
<h1>{title}</h1>
|
|
</EuiTitle>
|
|
</EuiPageHeaderSection>
|
|
</EuiPageHeader>
|
|
<EuiBreadcrumbs responsive={false} breadcrumbs={breadcrumbs} />
|
|
<EuiSpacer />
|
|
<EuiPageContent>
|
|
<EuiPageContentBody>{children}</EuiPageContentBody>
|
|
</EuiPageContent>
|
|
</EuiPageBody>
|
|
);
|
|
});
|