kibana/x-pack/examples/alerting_example/public/components/page.tsx
Antonio 6fc5c806ed
[ResponseOps] Migrate all usages of EuiPage*_Deprecated (#166188)
Fixes #161421

## Summary

As mentioned in the linked issue, I migrated all usages of
`EuiPage*_Deprecated` components listed below:


[x-pack/triggers_actions_ui](https://github.com/search?q=repo%3Aelastic%2Fkibana+%2FEuiPage%5Ba-zA-Z%5D%2B_Deprecated%2F+path%3A%2F%5Ex-pack%5C%2Fplugins%5C%2Ftriggers_actions_ui%2F&type=code)

[x-pack/examples/triggers_actions_ui_examples](https://github.com/search?q=repo%3Aelastic%2Fkibana+%2FEuiPage%5Ba-zA-Z%5D%2B_Deprecated%2F+path%3A%2F%5Ex-pack%5C%2Fexamples%5C%2Ftriggers_actions_ui_example%2F&type=code)

[x-pack/examples/alerting_example](https://github.com/search?q=repo%3Aelastic%2Fkibana+%2FEuiPage%5Ba-zA-Z%5D%2B_Deprecated%2F+path%3Ax-pack%2Fexamples%2Falerting_example&type=code)

[x-pack/test/functional_with_es_ssl/plugins/cases](https://github.com/search?q=repo%3Aelastic%2Fkibana+%2FEuiPage%5Ba-zA-Z%5D%2B_Deprecated%2F+path%3Ax-pack%2Ftest%2Ffunctional_with_es_ssl%2Fplugins%2Fcases&type=code)

The majority of these were in test environments and examples.

The only one actually in `x-pack/triggers_actions_ui` had to do with the
rule detail page. It looked basically the same after the change but a
`Pager` that was there became unnecessary. I removed it.
2023-09-12 15:57:40 +02:00

59 lines
1.4 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,
EuiPageHeader,
EuiPageHeaderSection,
EuiTitle,
EuiBreadcrumbs,
EuiSpacer,
EuiPageSection,
} 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 />
<EuiPageSection>{children}</EuiPageSection>
</EuiPageBody>
);
});