Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List: support responsive #7272

Merged
merged 7 commits into from Aug 21, 2017
Merged

List: support responsive #7272

merged 7 commits into from Aug 21, 2017

Conversation

nikogu
Copy link
Contributor

@nikogu nikogu commented Aug 21, 2017

  • support responsive just like Grid
  • fixed style on device with small screen

@nikogu nikogu self-assigned this Aug 21, 2017
@mention-bot
Copy link

@nikogu, thanks for your PR! By analyzing the history of the files in this pull request, we identified @ddcat1115 to be a potential reviewer.

sm={{ gutter: 16, column: 2 }}
md={{ gutter: 16, column: 4 }}
lg={{ gutter: 16, column: 6 }}
xl={{ gutter: 16, column: 8 }}
Copy link
Member

@afc163 afc163 Aug 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么需要配置?直接默认掉如何。

Copy link
Contributor Author

@nikogu nikogu Aug 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个会根据使用场景,自己决定要几列吧。。。比如如果他内容多,可能同样宽度列只要 2 列?

感觉 List.Item 的内容形式还是很多样的,可能是 Card,也可能是竖直的 List.Item,如果固定死了就不太好改,而且有时候,可能只需要定义其中一种,比如只需要 sm 的情况改一下

这里这个 demo,是为了展示所有的情况,就都写出来了。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

平时用不到的配置,最好不要影响默认的 demo。不然用户一般都是直接拷贝,或者以为是必选的。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xs sm 这一串都是依赖 grid 属性的,没有 grid 就没有意义。考虑下如何合并到 grid 里。


window.addEventListener('resize', gap(() => {
this.responsive();
}, 16.66));
Copy link
Member

@afc163 afc163 Aug 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

内部直接用 Col Row 做包装,不单独实现响应式。可以参考 https://github.com/ant-design/test/blob/master/scaffold/src/components/DescriptionList/DescriptionList.js

isNotRelease = false;
}, time);
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@throttleByAnimationFrameDecorator()

@@ -2167,7 +2167,6 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = `
id="input-number"
max="10"
min="1"
step="1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

更新下本地 node_modules。

sm?: number;
md?: number;
lg?: number;
xl?: number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

给一个固定值,貌似只能设置 24 的约数。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个固定的了吗...有可能我 List.Item 内容多,lg 下显示 2行,也有可能是 Cardlg 下显示 4 行

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是固定范围。。比如不能指定 7。

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum 2 3 4 6 8 12

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afc163 要不加个 warning 好了,然后还是自动 floor?

Copy link
Member

@afc163 afc163 Aug 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 ts 的定义 + react propTypes 进行约束。

@codecov
Copy link

codecov bot commented Aug 21, 2017

Codecov Report

Merging #7272 into antd-3.0 will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##           antd-3.0    #7272      +/-   ##
============================================
+ Coverage     86.12%   86.14%   +0.01%     
============================================
  Files           247      247              
  Lines          5060     5065       +5     
  Branches       1392     1393       +1     
============================================
+ Hits           4358     4363       +5     
  Misses          702      702
Impacted Files Coverage Δ
components/list/Item.tsx 100% <100%> (ø) ⬆️
components/list/index.tsx 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3b59a03...e345f78. Read the comment docs.

}
}

@media screen and (max-width: 480px) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

480px 和 768px 等应该用变量。

sm?: 1 | 2 | 3 | 4 | 8 | 12 | 24;
md?: 1 | 2 | 3 | 4 | 8 | 12 | 24;
lg?: 1 | 2 | 3 | 4 | 8 | 12 | 24;
xl?: 1 | 2 | 3 | 4 | 8 | 12 | 24;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6

@afc163 afc163 merged commit 56f0716 into antd-3.0 Aug 21, 2017
@afc163 afc163 deleted the feature-list-responsive branch August 21, 2017 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants