Skip to content

Commit

Permalink
Merge pull request #191 from oceanbase/dengfuping-dev
Browse files Browse the repository at this point in the history
fix(ui): reload should work when subTitle is null
  • Loading branch information
dengfuping authored Oct 18, 2023
2 parents 45db855 + 5f4e185 commit fa73c36
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 7 deletions.
24 changes: 22 additions & 2 deletions packages/ui/src/PageContainer/demo/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
/**
* iframe: 600
*/
import React from 'react';
import React, { useState } from 'react';
import { EllipsisOutlined } from '@oceanbase/icons';
import { Button, Descriptions, Dropdown, Radio } from '@oceanbase/design';
import { Button, Descriptions, Dropdown, Radio, message } from '@oceanbase/design';
import { PageContainer } from '@oceanbase/ui';

export default () => {
const [loading, setLoading] = useState(false);

const mockRequest = () => {
const promise = new Promise<void>(resolve => {
setTimeout(() => {
resolve();
}, 1000);
});
setLoading(true);
promise.then(() => {
setLoading(false);
message.success('刷新成功');
});
};
return (
<PageContainer
ghost={false}
header={{
title: '页面标题',
reload: {
spin: loading,
onClick: () => {
mockRequest();
},
},
breadcrumb: {
items: [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/PageContainer/demo/header-less.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default () => {
},
];
return (
<PageContainer ghost={true} header={{}}>
<PageContainer ghost={true}>
<Card
bordered={false}
tabList={[
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/PageContainer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const PageContainer = ({
reloadProps.className
);

const newSubTitle = subTitle && (
const newSubTitle = (reload || subTitle) && (
<Space size={12}>
{reload && (
<Tooltip title={locale.reload}>
Expand Down
9 changes: 6 additions & 3 deletions packages/ui/src/PageContainer/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export const genPageContainerStyle: GenerateStyle<PageContainerToken> = (
},
[`${antCls}-page-header`]: {
[`${antCls}-page-header-breadcrumb`]: {
marginBottom: 6,
// overwritten pro-components style
paddingBlockStart: 0,
},
[`${antCls}-page-header-heading-title`]: {
fontSize: fontSizeHeading3,
Expand Down Expand Up @@ -62,8 +63,10 @@ export const genPageContainerStyle: GenerateStyle<PageContainerToken> = (
},
// 减小内容区左右两侧间距
[`${componentCls}-warp-page-header`]: {
paddingInline: `${paddingLG}px !important`,
paddingBlock: `${padding}px !important`,
paddingInlineStart: paddingLG,
paddingInlineEnd: paddingLG,
paddingBlockStart: padding,
paddingBlockEnd: padding,
},
[`${componentCls}-children-container`]: {
paddingInline: paddingLG,
Expand Down

0 comments on commit fa73c36

Please sign in to comment.