Fix list border

This commit is contained in:
afc163 2017-10-26 15:36:48 +08:00
parent c44f9528be
commit 11c3abb3aa
4 changed files with 1056 additions and 973 deletions

View File

@ -5,6 +5,12 @@ exports[`renders ./components/list/demo/basic.md correctly 1`] = `
class="ant-list ant-list-split" class="ant-list ant-list-split"
> >
<div> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div <div
class="ant-list-item" class="ant-list-item"
> >
@ -154,6 +160,8 @@ exports[`renders ./components/list/demo/basic.md correctly 1`] = `
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
`; `;
@ -162,6 +170,12 @@ exports[`renders ./components/list/demo/grid.md correctly 1`] = `
class="ant-list ant-list-split ant-list-grid" class="ant-list ant-list-split ant-list-grid"
> >
<div> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div <div
class="ant-row" class="ant-row"
style="margin-left:-8px;margin-right:-8px" style="margin-left:-8px;margin-right:-8px"
@ -324,6 +338,8 @@ exports[`renders ./components/list/demo/grid.md correctly 1`] = `
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
`; `;
@ -335,7 +351,15 @@ exports[`renders ./components/list/demo/infinite-load.md correctly 1`] = `
<div <div
class="ant-list ant-list-split" class="ant-list ant-list-split"
> >
<div /> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
/>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -345,13 +369,21 @@ exports[`renders ./components/list/demo/infinite-virtualized-load.md correctly 1
<div <div
class="ant-list ant-list-split" class="ant-list ant-list-split"
> >
<div /> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
/>
</div>
</div>
</div> </div>
`; `;
exports[`renders ./components/list/demo/loadmore.md correctly 1`] = ` exports[`renders ./components/list/demo/loadmore.md correctly 1`] = `
<div <div
class="ant-list demo-loadmore-list ant-list-split ant-list-loading" class="ant-list demo-loadmore-list ant-list-split ant-list-loading ant-list-something-after-last-item"
> >
<div> <div>
<div <div
@ -396,6 +428,12 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
class="ant-list ant-list-split ant-list-grid" class="ant-list ant-list-split ant-list-grid"
> >
<div> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div <div
class="ant-row" class="ant-row"
style="margin-left:-8px;margin-right:-8px" style="margin-left:-8px;margin-right:-8px"
@ -636,6 +674,8 @@ exports[`renders ./components/list/demo/resposive.md correctly 1`] = `
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div> </div>
`; `;
@ -647,7 +687,7 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
Default Size Default Size
</h3> </h3>
<div <div
class="ant-list ant-list-split ant-list-bordered" class="ant-list ant-list-split ant-list-bordered ant-list-something-after-last-item"
> >
<div <div
class="ant-list-header" class="ant-list-header"
@ -657,6 +697,12 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
</div> </div>
</div> </div>
<div> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div <div
class="ant-list-item" class="ant-list-item"
> >
@ -703,6 +749,8 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<div <div
class="ant-list-footer" class="ant-list-footer"
> >
@ -717,7 +765,7 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
Small Size Small Size
</h3> </h3>
<div <div
class="ant-list ant-list-sm ant-list-split ant-list-bordered" class="ant-list ant-list-sm ant-list-split ant-list-bordered ant-list-something-after-last-item"
> >
<div <div
class="ant-list-header" class="ant-list-header"
@ -727,6 +775,12 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
</div> </div>
</div> </div>
<div> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div <div
class="ant-list-item" class="ant-list-item"
> >
@ -773,6 +827,8 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<div <div
class="ant-list-footer" class="ant-list-footer"
> >
@ -787,7 +843,7 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
Large Size Large Size
</h3> </h3>
<div <div
class="ant-list ant-list-lg ant-list-split ant-list-bordered" class="ant-list ant-list-lg ant-list-split ant-list-bordered ant-list-something-after-last-item"
> >
<div <div
class="ant-list-header" class="ant-list-header"
@ -797,6 +853,12 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
</div> </div>
</div> </div>
<div> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div <div
class="ant-list-item" class="ant-list-item"
> >
@ -843,6 +905,8 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<div <div
class="ant-list-footer" class="ant-list-footer"
> >
@ -856,9 +920,15 @@ exports[`renders ./components/list/demo/simple.md correctly 1`] = `
exports[`renders ./components/list/demo/vertical.md correctly 1`] = ` exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
<div <div
class="ant-list ant-list-vertical ant-list-lg ant-list-split" class="ant-list ant-list-vertical ant-list-lg ant-list-split ant-list-something-after-last-item"
> >
<div> <div>
<div
class="ant-spin-nested-loading"
>
<div
class="ant-spin-container"
>
<div <div
class="ant-list-item" class="ant-list-item"
> >
@ -1339,6 +1409,8 @@ exports[`renders ./components/list/demo/vertical.md correctly 1`] = `
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<div <div
class="ant-list-pagination" class="ant-list-pagination"
> >

View File

@ -102,9 +102,10 @@ ReactDOM.render(<InfiniteListExample />, mountNode);
````css ````css
.demo-infinite-container { .demo-infinite-container {
border: 1px solid #eee; border: 1px solid #e8e8e8;
border-radius: 4px;
overflow: auto; overflow: auto;
padding: 48px 16px; padding: 8px 16px;
height: 300px; height: 300px;
} }
.demo-loading { .demo-loading {

View File

@ -81,6 +81,11 @@ export default class List extends Component<ListProps> {
return renderItem(item, index); return renderItem(item, index);
} }
isSomethingAfterLastTtem() {
const { loadMore, pagination, footer } = this.props;
return !!(loadMore || pagination || footer);
}
render() { render() {
const { const {
bordered = false, bordered = false,
@ -122,6 +127,7 @@ export default class List extends Component<ListProps> {
[`${prefixCls}-bordered`]: bordered, [`${prefixCls}-bordered`]: bordered,
[`${prefixCls}-loading`]: loading, [`${prefixCls}-loading`]: loading,
[`${prefixCls}-grid`]: grid, [`${prefixCls}-grid`]: grid,
[`${prefixCls}-something-after-last-item`]: this.isSomethingAfterLastTtem(),
}); });
const paginationContent = ( const paginationContent = (
@ -140,19 +146,11 @@ export default class List extends Component<ListProps> {
<Row gutter={grid.gutter}>{childrenList}</Row> <Row gutter={grid.gutter}>{childrenList}</Row>
) : childrenList; ) : childrenList;
const content = loading ? ( const content = (
<div> <div>
<Spin> <Spin spinning={loading}>{childrenContent}</Spin>
{childrenContent}
</Spin>
{loadMore} {loadMore}
{(!loadMore && pagination) && paginationContent} {(!loadMore && pagination) ? paginationContent : null}
</div>
) : (
<div>
{childrenContent}
{loadMore}
{(!loadMore && pagination) && paginationContent}
</div> </div>
); );

View File

@ -105,11 +105,22 @@
flex: 0; flex: 0;
} }
} }
&-header,
&-footer {
padding-top: 12px;
padding-bottom: 12px;
}
} }
.@{list-prefix-cls}-split { .@{list-prefix-cls}-split {
.@{list-prefix-cls}-item { .@{list-prefix-cls}-item {
border-bottom: 1px solid @border-color-split; border-bottom: 1px solid @border-color-split;
&:last-child {
border-bottom: none;
}
}
.@{list-prefix-cls}-header {
border-bottom: 1px solid @border-color-split;
} }
} }
@ -123,21 +134,22 @@
border-radius: @border-radius-base; border-radius: @border-radius-base;
border: 1px solid @border-color-base; border: 1px solid @border-color-base;
.@{list-prefix-cls}-header { .@{list-prefix-cls}-header {
border-bottom: 1px solid @border-color-split; padding-left: 24px;
padding: 12px 24px; padding-right: 24px;
} }
.@{list-prefix-cls}-footer { .@{list-prefix-cls}-footer {
border-top: 1px solid @border-color-split; padding-left: 24px;
padding: 12px 24px; padding-right: 24px;
} }
.@{list-prefix-cls}-item { .@{list-prefix-cls}-item {
border-bottom: 1px solid @border-color-split; border-bottom: 1px solid @border-color-split;
padding-left: 24px; padding-left: 24px;
padding-right: 24px; padding-right: 24px;
} }
.@{list-prefix-cls}-item:last-child { }
border-bottom: none;
} .@{list-prefix-cls}-something-after-last-item .@{list-prefix-cls}-item:last-child {
border-bottom: 1px solid @border-color-split;
} }
.@{list-prefix-cls}-bordered.@{list-prefix-cls}-lg { .@{list-prefix-cls}-bordered.@{list-prefix-cls}-lg {