Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
feat: add disableContentMargin props
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Nov 26, 2019
1 parent c77c033 commit 1456cce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion example/src/layouts/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
rightContentRender={rightProps => (
<RightContent {...rightProps} {...settings} />
)}
contentStyle={{ margin: 0 }}
disableContentMargin
>
<ProLayout
navTheme="light"
Expand Down
3 changes: 3 additions & 0 deletions src/BasicLayout.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
.ant-layout {
transform: rotate(0);
}
&-disable-margin {
margin: 0;
}
}

// default children layout height
Expand Down
7 changes: 7 additions & 0 deletions src/BasicLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ export interface BasicLayoutProps
isChildrenLayout?: boolean;

className?: string;

/**
* 兼用 content的 margin
*/
disableContentMargin: boolean;
}

const headerRender = (props: BasicLayoutProps): React.ReactNode => {
Expand Down Expand Up @@ -224,6 +229,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = props => {
routes: [],
},
style,
disableContentMargin,
siderWidth = 256,
menu,
isChildrenLayout: propsIsChildrenLayout,
Expand Down Expand Up @@ -384,6 +390,7 @@ Pro-Layout 在 4.7 中支持了 subMenu 的 render, 会导致 menu 变成蓝色

const contentClassName = classNames('ant-pro-basicLayout-content', {
'ant-pro-basicLayout-has-header': headerDom,
'ant-pro-basicLayout-content-disable-margin': disableContentMargin,
});

return (
Expand Down

0 comments on commit 1456cce

Please sign in to comment.