diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space.test.tsx.snap index 31de1c9ea55e9..66da6992614bc 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space.test.tsx.snap +++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/__snapshots__/customize_space.test.tsx.snap @@ -3,7 +3,6 @@ exports[`renders correctly 1`] = ` { expect(wrapper).toMatchSnapshot(); }); +test('allows title prop', () => { + const space = { + id: 'space-3', + name: 'Space 3', + initials: 'S3', + color: '#FEEDED', + customAvatarInitials: true, + customAvatarColor: true, + }; + const changeHandler = jest.fn(); + + const wrapper = shallowWithIntl( + + ); + expect(wrapper.find(SectionPanel).prop('title')).toBe('Cool Customize Space Title'); +}); + test('updates identifier, initials and color when name is changed', () => { const space = { id: 'space-1', diff --git a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx index 1de97136e9104..33113f3338960 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/customize_space/customize_space.tsx @@ -37,6 +37,7 @@ interface Props { space: FormValues; editingExistingSpace: boolean; onChange: (space: FormValues) => void; + title?: string; } interface State { @@ -51,14 +52,11 @@ export class CustomizeSpace extends Component { }; public render() { - const { validator, editingExistingSpace, space } = this.props; + const { validator, editingExistingSpace, space, title } = this.props; const { name = '', description = '' } = space; - const panelTitle = i18n.translate('xpack.spaces.management.manageSpacePage.generalTitle', { - defaultMessage: 'General', - }); return ( - + diff --git a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx index b56a4f6434047..b34d2eec88e48 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/manage_space_page.tsx @@ -189,6 +189,9 @@ export class ManageSpacePage extends Component { return (
{ {!!this.props.allowSolutionVisibility && ( <> - + )} diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap b/x-pack/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap index 630de56f3bbdc..5880163e5c386 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap +++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/__snapshots__/section_panel.test.tsx.snap @@ -34,3 +34,14 @@ exports[`it renders without blowing up 1`] = `

`; + +exports[`it renders without optional title 1`] = ` + +

+ child +

+
+`; diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx index 125697c6f4e19..661060c6adf8c 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.test.tsx @@ -21,6 +21,16 @@ test('it renders without blowing up', () => { expect(wrapper).toMatchSnapshot(); }); +test('it renders without optional title', () => { + const wrapper = shallowWithIntl( + +

child

+
+ ); + + expect(wrapper).toMatchSnapshot(); +}); + test('it renders children', () => { const wrapper = mountWithIntl( diff --git a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx index 3d07aaabfd6b3..8024df2d6e85f 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/section_panel/section_panel.tsx @@ -12,7 +12,7 @@ import React, { Component, Fragment } from 'react'; interface Props { iconType?: IconType; - title: string | ReactNode; + title?: string | ReactNode; dataTestSubj?: string; } @@ -27,6 +27,10 @@ export class SectionPanel extends Component { } public getTitle = () => { + if (!this.props.title) { + return null; + } + return ( @@ -52,7 +56,7 @@ export class SectionPanel extends Component { public getForm = () => { return ( - + {this.props.title ? : null} {this.props.children} ); diff --git a/x-pack/plugins/spaces/public/management/edit_space/solution_view/solution_view.tsx b/x-pack/plugins/spaces/public/management/edit_space/solution_view/solution_view.tsx index 0a6dc317161f2..608454a75600b 100644 --- a/x-pack/plugins/spaces/public/management/edit_space/solution_view/solution_view.tsx +++ b/x-pack/plugins/spaces/public/management/edit_space/solution_view/solution_view.tsx @@ -98,18 +98,14 @@ const getOptions = ({ size }: EuiThemeComputed): Array; onChange: (space: Partial) => void; + sectionTitle?: string; } -export const SolutionView: FunctionComponent = ({ space, onChange }) => { +export const SolutionView: FunctionComponent = ({ space, onChange, sectionTitle }) => { const { euiTheme } = useEuiTheme(); return ( - +