From 76a138e6f87cf7a041e1c25d2708ae9cf236bb9d Mon Sep 17 00:00:00 2001 From: dengfuping Date: Fri, 19 Jan 2024 18:11:27 +0800 Subject: [PATCH] improve(ui): PageContainer style when first child is Tabs --- .../ui/src/PageContainer/demo/with-tabs.tsx | 99 +++++++++++++++++++ packages/ui/src/PageContainer/index.md | 2 + packages/ui/src/PageContainer/style/index.ts | 5 + 3 files changed, 106 insertions(+) create mode 100644 packages/ui/src/PageContainer/demo/with-tabs.tsx diff --git a/packages/ui/src/PageContainer/demo/with-tabs.tsx b/packages/ui/src/PageContainer/demo/with-tabs.tsx new file mode 100644 index 000000000..2b75053eb --- /dev/null +++ b/packages/ui/src/PageContainer/demo/with-tabs.tsx @@ -0,0 +1,99 @@ +/** + * iframe: 600 + */ +import React, { useState } from 'react'; +import { EllipsisOutlined } from '@oceanbase/icons'; +import { Button, Descriptions, Dropdown, Input, Radio, Tabs, message } from '@oceanbase/design'; +import { PageContainer } from '@oceanbase/ui'; + +export default () => { + const [loading, setLoading] = useState(false); + + const mockRequest = () => { + const promise = new Promise(resolve => { + setTimeout(() => { + resolve(); + }, 1000); + }); + setLoading(true); + promise.then(() => { + setLoading(false); + message.success('刷新成功'); + }); + }; + return ( + { + mockRequest(); + }, + }, + breadcrumb: { + items: [ + { + href: '', + title: '一级页面', + }, + { + href: '', + title: '二级页面', + }, + { + title: '当前页面', + }, + ], + }, + extra: [ + , + , + + + , + ], + }} + footer={[, ]} + > + + + ); +}; diff --git a/packages/ui/src/PageContainer/index.md b/packages/ui/src/PageContainer/index.md index f95e7eace..940ff7765 100644 --- a/packages/ui/src/PageContainer/index.md +++ b/packages/ui/src/PageContainer/index.md @@ -19,6 +19,8 @@ nav: + + diff --git a/packages/ui/src/PageContainer/style/index.ts b/packages/ui/src/PageContainer/style/index.ts index d207ea89a..567fb9726 100644 --- a/packages/ui/src/PageContainer/style/index.ts +++ b/packages/ui/src/PageContainer/style/index.ts @@ -58,6 +58,11 @@ export const genPageContainerStyle: GenerateStyle = ( paddingInline: paddingLG, paddingBlockStart: 0, paddingBlockEnd: paddingLG, + // set top tabs style when it is PageContainer's first child + [`& > ${antCls}-tabs-top:not(${antCls}-tabs-card):first-child`]: { + // equal to page header paddingBlockEnd + marginTop: -padding, + }, }, // remove paddingBlockStart for page header without breadcrumb [`${antCls}-page-header:not(${antCls}-page-header-has-breadcrumb)`]: {