Skip to content

Commit

Permalink
[Uptime UI] Remove wrapped StyledPageTemplateComponent (#148116)
Browse files Browse the repository at this point in the history
Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: shahzad31 <[email protected]>
  • Loading branch information
3 people authored Dec 28, 2022
1 parent 2351910 commit 37df467
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 124 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
* 2.0.
*/

import React, { useEffect, useMemo } from 'react';
import styled from 'styled-components';
import { EuiPageHeaderProps, EuiPageTemplateProps, useIsWithinMaxBreakpoint } from '@elastic/eui';
import React, { useEffect } from 'react';
import { EuiPageHeaderProps, EuiPageTemplateProps } from '@elastic/eui';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import { useInspectorContext } from '@kbn/observability-plugin/public';
import { CERTIFICATES_ROUTE, OVERVIEW_ROUTE } from '../../../common/constants';
Expand All @@ -22,12 +21,6 @@ interface Props {
pageHeader?: EuiPageHeaderProps;
}

const mobileCenteredHeader = `
.euiPageHeaderContent > .euiFlexGroup > .euiFlexItem {
align-items: center;
}
`;

export const UptimePageTemplateComponent: React.FC<Props & EuiPageTemplateProps> = ({
path,
pageHeader,
Expand All @@ -37,18 +30,8 @@ export const UptimePageTemplateComponent: React.FC<Props & EuiPageTemplateProps>
const {
services: { observability },
} = useKibana<ClientPluginsStart>();
const isMobile = useIsWithinMaxBreakpoint('s');

const PageTemplateComponent = observability.navigation.PageTemplate;
const StyledPageTemplateComponent = useMemo(() => {
return styled(PageTemplateComponent)<{ isMobile: boolean }>`
.euiPageHeaderContent > .euiFlexGroup {
flex-wrap: wrap;
}
${(props) => (props.isMobile ? mobileCenteredHeader : '')}
`;
}, [PageTemplateComponent]);

const noDataConfig = useNoDataConfig();

Expand All @@ -69,8 +52,7 @@ export const UptimePageTemplateComponent: React.FC<Props & EuiPageTemplateProps>

return (
<>
<StyledPageTemplateComponent
isMobile={isMobile}
<PageTemplateComponent
pageHeader={pageHeader}
data-test-subj={noDataConfig ? 'data-missing' : undefined}
noDataConfig={isMainRoute && !loading ? noDataConfig : undefined}
Expand All @@ -84,7 +66,7 @@ export const UptimePageTemplateComponent: React.FC<Props & EuiPageTemplateProps>
>
{children}
</div>
</StyledPageTemplateComponent>
</PageTemplateComponent>
</>
);
};

0 comments on commit 37df467

Please sign in to comment.