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,42 +55,54 @@ const PageHeaderWrapper = ({ ...@@ -53,42 +55,54 @@ const PageHeaderWrapper = ({
<MenuContext.Consumer> <MenuContext.Consumer>
{value => { {value => {
return ( return (
<PageHeader <div className={styles.wrapper}>
wide={contentWidth === 'Fixed'} <div
title={ className={classNames({
<Title [styles.wide]: !fluid && contentWidth === 'Fixed',
level={4} })}
style={{ >
marginBottom: 0, <PageHeader
}} title={
<>
{logo && <span className={styles.logo}>{logo}</span>}
<Title
level={4}
style={{
marginBottom: 0,
display: 'inline-block',
}}
>
{title}
</Title>
</>
}
key="pageheader"
{...restProps}
breadcrumb={
!hiddenBreadcrumb &&
conversionBreadcrumbList({
...value,
...restProps,
...(home !== null && {
home: <FormattedMessage id="menu.home" defaultMessage="Home" />,
}),
})
}
className={styles.pageHeader}
linkElement={Link}
footer={renderFooter(restProps)}
> >
{title} <div className={styles.detail}>
</Title> <div className={styles.main}>
} <div className={styles.row}>
key="pageheader" {content && <div className={styles.content}>{content}</div>}
{...restProps} {extraContent && <div className={styles.extraContent}>{extraContent}</div>}
breadcrumb={ </div>
!hiddenBreadcrumb && </div>
conversionBreadcrumbList({
...value,
...restProps,
home: <FormattedMessage id="menu.home" defaultMessage="Home" />,
})
}
className={styles.pageHeader}
linkElement={Link}
footer={renderFooter(restProps)}
>
<div className={styles.detail}>
{logo && <div className={styles.logo}>{logo}</div>}
<div className={styles.main}>
<div className={styles.row}>
{content && <div className={styles.content}>{content}</div>}
{extraContent && <div className={styles.extraContent}>{extraContent}</div>}
</div> </div>
</div> </PageHeader>
</div> </div>
</PageHeader> </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