Skip to content

Commit

Permalink
fix(panel): show divider (#1788)
Browse files Browse the repository at this point in the history
Co-authored-by: maxin <maxin@growingio.com>
  • Loading branch information
nnmax and maxin committed Jan 12, 2022
1 parent 5632662 commit 4fdfab8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
2 changes: 0 additions & 2 deletions src/panel/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { difference } from 'lodash';
import { useControlledState, usePrefixCls } from '@gio-design/utils';
import Typography from '../typography';
import Tabs, { Tab } from '../tabs';
import Divider from '../divider';
import { PanelProps, TabPaneProps } from './interfaces';
import TabPanel from './TabPanel';
import { Avatar } from '..';
Expand Down Expand Up @@ -97,7 +96,6 @@ const InnerPanel: React.ForwardRefRenderFunction<HTMLDivElement, PanelProps> = (
);
})}
</Tabs>
<Divider className={prefix('__tabs__divider')} />
</div>
{panelTabs[currentTabIndex]}
</>
Expand Down
14 changes: 9 additions & 5 deletions src/panel/TabPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { difference } from 'lodash';
import { TabsProps } from '../tabs';
import { TabPaneProps } from './interfaces';
import ToolBar from './ToolBar';
import Divider from '../divider';

const TabPanel: React.FC<TabPaneProps> = (props) => {
const { className, style, children } = props;
Expand All @@ -19,13 +20,16 @@ const TabPanel: React.FC<TabPaneProps> = (props) => {

const showToolBars = toolBars.length > 0;

const prefixCls = usePrefixCls('panel__tab-panel');
const prefixCls = usePrefixCls('panel');

return (
<div className={classNames(prefixCls, className)} style={style}>
{showToolBars ? <div className={`${prefixCls}__container`}>{toolBars}</div> : null}
{otherChildren}
</div>
<>
{showToolBars ? <Divider className={`${prefixCls}__divider`} /> : null}
<div className={classNames(`${prefixCls}__tab-panel`, className)} style={style}>
{showToolBars ? <div className={`${prefixCls}__tab-panel__container`}>{toolBars}</div> : null}
{otherChildren}
</div>
</>
);
};

Expand Down
8 changes: 0 additions & 8 deletions src/panel/demos/Panel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,6 @@ const MultiplePanel: Story<PanelProps> = (args) => {
/>
</TabPanel>
<TabPanel key="2" name="权限">
<ToolBar>
<SearchBar style={{ width: 360 }} />
</ToolBar>
<ToolBar float="right">
<Button prefix={<PlusOutlined />}>新建账号</Button>
<Button type="secondary">次要按钮</Button>
<Button type="secondary">次要按钮</Button>
</ToolBar>
{/** Table高度自适应通过 scroll.y 实现 */}
<Table dataSource={dataSource2} columns={columns2} scroll={{ y: 'calc(100vh - 359px)' as any }} />
</TabPanel>
Expand Down
7 changes: 4 additions & 3 deletions src/panel/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@
width: auto;
margin: 0 20px;
}
&__divider {
margin: 0;
}
}

&__divider {
margin: 0;
}

&__content {
Expand Down
1 change: 1 addition & 0 deletions src/panel/style/tabPanel.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@panel-tab-panelprefix-cls: ~'@{component-prefix}-panel__tab-panel';

.@{panel-tab-panelprefix-cls} {
display: flow-root;
&__container {
margin: 20px 14px;
overflow: hidden;
Expand Down

0 comments on commit 4fdfab8

Please sign in to comment.