Skip to content

Commit

Permalink
inline conditional rendering (ant-design#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
rioarray authored and chenshuai2144 committed Oct 15, 2019
1 parent d064557 commit 0f1e78d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions AccountCenter/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent<
<Row gutter={24}>
<Col lg={7} md={24}>
<Card bordered={false} style={{ marginBottom: 24 }} loading={dataLoading}>
{!dataLoading ? (
{!dataLoading && (
<div>
<div className={styles.avatarHolder}>
<img alt="" src={currentUser.avatar} />
Expand Down Expand Up @@ -227,7 +227,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent<
</Row>
</div>
</div>
) : null}
)}
</Card>
</Col>
<Col lg={17} md={24}>
Expand Down
27 changes: 13 additions & 14 deletions ListSearchArticles/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,19 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<PAGE_NAME_UPPER_CAMEL_CASEPro
},
};

const loadMore =
list.length > 0 ? (
<div style={{ textAlign: 'center', marginTop: 16 }}>
<Button onClick={this.fetchMore} style={{ paddingLeft: 48, paddingRight: 48 }}>
{loading ? (
<span>
<Icon type="loading" /> 加载中...
</span>
) : (
'加载更多'
)}
</Button>
</div>
) : null;
const loadMore = list.length > 0 && (
<div style={{ textAlign: 'center', marginTop: 16 }}>
<Button onClick={this.fetchMore} style={{ paddingLeft: 48, paddingRight: 48 }}>
{loading ? (
<span>
<Icon type="loading" /> 加载中...
</span>
) : (
'加载更多'
)}
</Button>
</div>
);

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions ListSearchProjects/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<PAGE_NAME_UPPER_CAMEL_CASEPro
} = this.props;
const { getFieldDecorator } = form;

const cardList = list ? (
const cardList = list && (
<List<ListItemDataType>
rowKey="id"
loading={loading}
Expand Down Expand Up @@ -80,7 +80,7 @@ class PAGE_NAME_UPPER_CAMEL_CASE extends Component<PAGE_NAME_UPPER_CAMEL_CASEPro
</List.Item>
)}
/>
) : null;
);

const formItemLayout = {
wrapperCol: {
Expand Down

0 comments on commit 0f1e78d

Please sign in to comment.