Commit 34f1c4f8 authored by Rayron Victor's avatar Rayron Victor Committed by 陈帅

PageHeaderWrapper: fixed width, logo and home (#4187)

* PageHeaderWrapper with fixed width when contentWidth === 'Fixed' and an
new prop fluid that indicate PageHeaderWrapper to be fluid independent of
contentWidth

* PageHeaderWrapper: logo side by side with title

* PageHeaderWrapper: home={null} working again

* fix title-view-extra position
parent b9d9724a
...@@ -38,7 +38,9 @@ const renderFooter = ({ tabList, tabActiveKey, onTabChange, tabBarExtraContent } ...@@ -38,7 +38,9 @@ const renderFooter = ({ tabList, tabActiveKey, onTabChange, tabBarExtraContent }
const PageHeaderWrapper = ({ const PageHeaderWrapper = ({
children, children,
contentWidth, contentWidth,
fluid,
wrapperClassName, wrapperClassName,
home,
top, top,
title, title,
content, content,
...@@ -53,17 +55,26 @@ const PageHeaderWrapper = ({ ...@@ -53,17 +55,26 @@ const PageHeaderWrapper = ({
<MenuContext.Consumer> <MenuContext.Consumer>
{value => { {value => {
return ( return (
<div className={styles.wrapper}>
<div
className={classNames({
[styles.wide]: !fluid && contentWidth === 'Fixed',
})}
>
<PageHeader <PageHeader
wide={contentWidth === 'Fixed'}
title={ title={
<>
{logo && <span className={styles.logo}>{logo}</span>}
<Title <Title
level={4} level={4}
style={{ style={{
marginBottom: 0, marginBottom: 0,
display: 'inline-block',
}} }}
> >
{title} {title}
</Title> </Title>
</>
} }
key="pageheader" key="pageheader"
{...restProps} {...restProps}
...@@ -72,7 +83,9 @@ const PageHeaderWrapper = ({ ...@@ -72,7 +83,9 @@ const PageHeaderWrapper = ({
conversionBreadcrumbList({ conversionBreadcrumbList({
...value, ...value,
...restProps, ...restProps,
...(home !== null && {
home: <FormattedMessage id="menu.home" defaultMessage="Home" />, home: <FormattedMessage id="menu.home" defaultMessage="Home" />,
}),
}) })
} }
className={styles.pageHeader} className={styles.pageHeader}
...@@ -80,7 +93,6 @@ const PageHeaderWrapper = ({ ...@@ -80,7 +93,6 @@ const PageHeaderWrapper = ({
footer={renderFooter(restProps)} footer={renderFooter(restProps)}
> >
<div className={styles.detail}> <div className={styles.detail}>
{logo && <div className={styles.logo}>{logo}</div>}
<div className={styles.main}> <div className={styles.main}>
<div className={styles.row}> <div className={styles.row}>
{content && <div className={styles.content}>{content}</div>} {content && <div className={styles.content}>{content}</div>}
...@@ -89,6 +101,8 @@ const PageHeaderWrapper = ({ ...@@ -89,6 +101,8 @@ const PageHeaderWrapper = ({
</div> </div>
</div> </div>
</PageHeader> </PageHeader>
</div>
</div>
); );
}} }}
</MenuContext.Consumer> </MenuContext.Consumer>
......
...@@ -5,11 +5,20 @@ ...@@ -5,11 +5,20 @@
} }
.main { .main {
:global { .wrapper {
.ant-page-header { padding: 16px 24px 0;
padding: 16px 32px 0;
background: #fff; background: #fff;
border-bottom: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8;
:global {
.ant-page-header {
padding: 0;
}
.ant-page-header-title-view-extra {
top: 0;
right: 0;
}
} }
} }
...@@ -27,9 +36,10 @@ ...@@ -27,9 +36,10 @@
} }
.logo { .logo {
flex: 0 1 auto; display: inline-block;
margin-top: -1px;
margin-right: 16px; margin-right: 16px;
padding-top: 1px; vertical-align: middle;
> img { > img {
display: block; display: block;
width: 28px; width: 28px;
...@@ -66,7 +76,6 @@ ...@@ -66,7 +76,6 @@
margin-bottom: 16px; margin-bottom: 16px;
} }
.logo,
.content, .content,
.extraContent { .extraContent {
margin-bottom: 16px; margin-bottom: 16px;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment