From bebc26dbe5464c69cd3cfb7cb09d8a3b1af0f45a Mon Sep 17 00:00:00 2001 From: Wuxh Date: Fri, 3 Mar 2023 10:07:24 +0800 Subject: [PATCH] refactor: improve content padding when disable footer (#1517) * chore(theme): improve the default theme style * chore: update Content style * chore: update --- .../theme-default/slots/Content/index.less | 16 ++++++++++++++++ src/client/theme-default/slots/Content/index.tsx | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/client/theme-default/slots/Content/index.less b/src/client/theme-default/slots/Content/index.less index 0f648dded3..cc89ebb089 100644 --- a/src/client/theme-default/slots/Content/index.less +++ b/src/client/theme-default/slots/Content/index.less @@ -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; + } } } @@ -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; + } + } } diff --git a/src/client/theme-default/slots/Content/index.tsx b/src/client/theme-default/slots/Content/index.tsx index ca266ce44e..1704fff827 100644 --- a/src/client/theme-default/slots/Content/index.tsx +++ b/src/client/theme-default/slots/Content/index.tsx @@ -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 (
{props.children}