Skip to content

Commit

Permalink
fix(layout): PageContainer support childrenContentStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Nov 1, 2022
1 parent bb0e5da commit 2a487cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
],
"dependencies": {
"@ant-design/icons": "^4.2.1",
"@ant-design/pro-provider": "2.0.13",
"@ant-design/pro-utils": "2.2.13",
"@babel/runtime": "^7.18.0",
"classnames": "^2.2.6",
Expand Down
9 changes: 7 additions & 2 deletions packages/layout/src/components/PageContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ const memoRenderPageHeader = (
header,
prefixedClassName,
extraContent,
childrenContentStyle,
style,
prefixCls,
hashId,
Expand Down Expand Up @@ -289,6 +290,7 @@ const PageContainerBase: React.FC<PageContainerProps> = (props) => {
token: propsToken,
fixedHeader,
breadcrumbRender,
childrenContentStyle,
...restProps
} = props;
const value = useContext(RouteContext);
Expand Down Expand Up @@ -344,12 +346,15 @@ const PageContainerBase: React.FC<PageContainerProps> = (props) => {
const content = useMemo(() => {
return children ? (
<>
<div className={classNames(`${basePageContainer}-children-content ${hashId}`)}>
<div
className={classNames(`${basePageContainer}-children-content ${hashId}`)}
style={childrenContentStyle}
>
{children}
</div>
</>
) : null;
}, [children, basePageContainer, hashId]);
}, [children, basePageContainer, childrenContentStyle, hashId]);

const renderContentDom = useMemo(() => {
// 只要loadingDom非空我们就渲染loadingDom,否则渲染内容
Expand Down
1 change: 1 addition & 0 deletions packages/layout/src/components/PageHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface PageHeaderProps {
title?: React.ReactNode;
subTitle?: React.ReactNode;
style?: React.CSSProperties;
childrenContentStyle?: React.CSSProperties;
breadcrumb?: BreadcrumbProps | React.ReactElement<typeof Breadcrumb>;
breadcrumbRender?: (props: PageHeaderProps, defaultDom: React.ReactNode) => React.ReactNode;
tags?: React.ReactElement<TagType> | React.ReactElement<TagType>[];
Expand Down

0 comments on commit 2a487cf

Please sign in to comment.