Skip to content

Commit

Permalink
Fixing style errors caused by too low height
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Jul 13, 2018
1 parent 78e8ab5 commit c8217e0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions components/drawer/demo/from-drawer.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class App extends React.Component {
onClose={this.onClose}
maskClosable={false}
visible={this.state.visible}
style={{
height: 'calc(100% - 55px)',
overflow: 'auto',
paddingBottom: 53,
}}
>
<Form layout="vertical" hideRequiredMark>
<Row gutter={16}>
Expand Down Expand Up @@ -159,6 +164,7 @@ class App extends React.Component {
padding: '10px 16px',
textAlign: 'right',
left: 0,
background: '#fff',
borderRadius: '0 0 4px 4px',
}}
>
Expand Down
12 changes: 10 additions & 2 deletions components/drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export default class Drawer extends React.Component<
}

renderBody = () => {
if (this.props.destroyOnClose && !this.props.visible) {
const { destroyOnClose , visible, width, placement } = this.props;
if (destroyOnClose && !visible) {
return null;
}
const { prefixCls, title, closable } = this.props;
Expand All @@ -100,7 +101,14 @@ export default class Drawer extends React.Component<
</button>
);
}
const containerStyle = { width: this.props.width };
let containerStyle: React.CSSProperties = { width };
if (placement === 'left' || placement === 'right') {
containerStyle = {
overflow: 'auto',
height: '100%',
width,
};
}
return (
<div style={containerStyle}>
{header}
Expand Down

0 comments on commit c8217e0

Please sign in to comment.