Skip to content

Commit

Permalink
Applying Clint's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Maja Grubic committed Apr 7, 2022
1 parent 79c1f30 commit 800117c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
* Side Public License, v 1.
*/

import { shallow } from 'enzyme';
import { KibanaPageTemplateInner } from './page_template_inner';
// imports from npm packages
import React from 'react';
import { shallow } from 'enzyme';

// imports from elastic packages
import { EuiEmptyPrompt, EuiPageTemplate } from '@elastic/eui';

// imports from immediate files
import { KibanaPageTemplateInner } from './page_template_inner';

describe('KibanaPageTemplateInner', () => {
const pageHeader = {
iconType: 'test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import React, { FunctionComponent } from 'react';

import { EuiEmptyPrompt, EuiPageTemplate } from '@elastic/eui';

import { withSolutionNav } from './with_solution_nav';
import { KibanaPageTemplateProps } from './types';
import { getClasses } from './util';
Expand All @@ -31,17 +32,20 @@ export const KibanaPageTemplateInner: FunctionComponent<Props> = ({
*/
const emptyStateDefaultTemplate = 'centeredBody';
let header = pageHeader;

if (isEmptyState) {
if (pageHeader && !children) {
template = template ?? emptyStateDefaultTemplate;
const { iconType, pageTitle, description, rightSideItems } = pageHeader;
const title = pageTitle ? <h1>{pageTitle}</h1> : undefined;
const body = description ? <p>{description}</p> : undefined;
header = undefined;
children = (
<EuiEmptyPrompt
iconType={iconType}
iconColor={''} // This is likely a solution or app logo, so keep it multi-color
title={pageTitle ? <h1>{pageTitle}</h1> : undefined}
body={description ? <p>{description}</p> : undefined}
iconColor="" // This is likely a solution or app logo, so keep it multi-color
title={title}
body={body}
actions={rightSideItems}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ export const withSolutionNav = (WrappedComponent: ComponentType<KibanaPageTempla
} as EuiPageSideBarProps; // needed because for some reason 'none' is not recognized as a valid value for paddingSize
return (
<WrappedComponent
{...propagatedProps}
pageSideBar={pageSideBar}
pageSideBarProps={pageSideBarProps}
template={templateToUse}
{...{ ...propagatedProps, pageSideBar, pageSideBarProps, template: templateToUse }}
>
{children}
</WrappedComponent>
);
};

WithSolutionNav.displayName = `WithSolutionNavBar(${getDisplayName(WrappedComponent)})`;

return WithSolutionNav;
};

0 comments on commit 800117c

Please sign in to comment.