Skip to content

Commit

Permalink
fix(layout): fix bgLayout no work error
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Jan 15, 2024
1 parent 2337d6b commit 4a21fdf
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/layout/src/ProLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,11 @@ const BaseProLayout: React.FC<ProLayoutProps> = (props) => {

useDocumentTitle(pageTitleInfo, props.title || false);

const { token } = useContext(ProProvider);

const bgImgStyleList = useMemo(() => {
if (bgLayoutImgList && bgLayoutImgList.length > 0) {
return bgLayoutImgList.map((item, index) => {
return bgLayoutImgList?.map((item, index) => {
return (
<img
key={index}
Expand All @@ -742,8 +744,6 @@ const BaseProLayout: React.FC<ProLayoutProps> = (props) => {
return null;
}, [bgLayoutImgList]);

const { token } = useContext(ProProvider);

return wrapSSR(
<RouteContext.Provider
value={{
Expand Down Expand Up @@ -772,7 +772,7 @@ const BaseProLayout: React.FC<ProLayoutProps> = (props) => {
<>{children}</>
) : (
<div className={className}>
{bgImgStyleList ? (
{bgImgStyleList || token.layout?.bgLayout ? (
<div
className={classNames(`${proLayoutClassName}-bg-list`, hashId)}
>
Expand Down
3 changes: 3 additions & 0 deletions tests/form/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -49039,6 +49039,9 @@ exports[`form demos > 📸 renders ./packages/form/src/demos/layout-footer.tsx c
<div
class="ant-design-pro ant-pro-layout screen-xs ant-pro-layout-fix-siderbar ant-pro-layout-mix"
>
<div
class="ant-pro-layout-bg-list"
/>
<div
class="ant-layout"
style="min-height: 100%; flex-direction: row;"
Expand Down
Loading

0 comments on commit 4a21fdf

Please sign in to comment.