Skip to content

Commit

Permalink
refactor: improve content padding when disable footer (#1517)
Browse files Browse the repository at this point in the history
* chore(theme): improve the default theme style

* chore: update Content style

* chore: update
  • Loading branch information
Wxh16144 authored Mar 3, 2023
1 parent 870b38a commit bebc26d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/client/theme-default/slots/Content/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,20 @@
background-color: lighten(@c-site-bg-dark, 3%);
}

&[data-no-footer] {
padding-bottom: @s-content-padding;
}

@media @mobile {
max-width: initial;
margin: 0 -24px;
padding: 24px 24px 0;
border-radius: 0;
box-shadow: none;

&[data-no-footer] {
padding: 24px;
}
}
}

Expand All @@ -175,4 +183,12 @@
min-height: calc(100vh - @s-header-height-m);
}
}

&[data-no-sidebar][data-no-footer] {
margin-bottom: @s-content-padding;

@media @mobile {
margin-bottom: 24px;
}
}
}
4 changes: 3 additions & 1 deletion src/client/theme-default/slots/Content/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { useSidebarData } from 'dumi';
import { useSidebarData, useSiteData } from 'dumi';
import React, { type FC, type ReactNode } from 'react';
import './heti.scss';
import './index.less';

const Content: FC<{ children: ReactNode }> = (props) => {
const sidebar = useSidebarData();
const { themeConfig } = useSiteData();

return (
<div
className="dumi-default-content"
data-no-sidebar={!sidebar || undefined}
data-no-footer={themeConfig.footer === false || undefined}
>
{props.children}
</div>
Expand Down

0 comments on commit bebc26d

Please sign in to comment.