Skip to content

Commit

Permalink
fix(Shell): header should be able to be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
youluna committed Oct 11, 2019
1 parent b68cbf9 commit c1ef847
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shell/shell.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export default function ShellBase(props) {
}

if (!branding) {
layout.header.Branding = trigger;
trigger && (layout.header.Branding = trigger);
} else {
layout.header.Branding = React.cloneElement(branding, {}, [
trigger,
Expand Down Expand Up @@ -520,7 +520,7 @@ export default function ShellBase(props) {
}

// 按照dom结构, arr 包括 header Navigation ToolDock 和 innerArr
if (layout.header) {
if (Object.keys(layout.header).length > 0) {
headerDom = (
<header key="header" className={headerCls}>
{layout.header.Branding}
Expand Down
30 changes: 30 additions & 0 deletions test/shell/index-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,5 +228,35 @@ describe('Shell', () => {

assert(wrapper.find('.next-shell-navigation.next-shell-collapse'));
});

it('should support no header', () => {
wrapper = render(
<Shell className={"iframe-hack"} style={{border: '1px solid #eee'}}>
<Shell.Navigation trigger={null}>
<Nav embeddable aria-label="global navigation">
<Nav.Item icon="account">Nav Item 1</Nav.Item>
<Nav.Item icon="calendar">Nav Item 2</Nav.Item>
<Nav.Item icon="atm">Nav Item 3</Nav.Item>
<Nav.Item icon="account">Nav Item 4</Nav.Item>
<Nav.Item icon="account">Nav Item 5</Nav.Item>
<Nav.Item icon="account">Nav Item 6</Nav.Item>
<Nav.Item icon="account">Nav Item 7</Nav.Item>
</Nav>
</Shell.Navigation>

<Shell.Content>
<div style={{minHeight: 1200, background: '#fff'}}></div>
</Shell.Content>

<Shell.Footer>
<span>Alibaba Fusion</span>
<span>@ 2019 Alibaba Piecework 版权所有</span>
</Shell.Footer>
</Shell>
);

assert(wrapper.find('.next-shell-header').length === 0);
});

});
});

0 comments on commit c1ef847

Please sign in to comment.