mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
Add some random width for skeleton paragraph
This commit is contained in:
parent
6360c8b657
commit
1a3e59c0da
@ -59,7 +59,7 @@ class Paragraph extends React.Component<SkeletonParagraphProps, SkeletonParagrap
|
|||||||
const { prefixCls, className, style, rows } = this.props;
|
const { prefixCls, className, style, rows } = this.props;
|
||||||
|
|
||||||
const rowList = [...Array(rows)].map((_, index) => (
|
const rowList = [...Array(rows)].map((_, index) => (
|
||||||
<li key={index} style={{ width: widthList[index] || '100%' }} />
|
<li key={index} style={{ width: widthList[index] }} />
|
||||||
));
|
));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
order: 1
|
order: 2
|
||||||
title:
|
title:
|
||||||
zh-CN: 动画效果
|
zh-CN: 动画效果
|
||||||
en-US: Active Animation
|
en-US: Active Animation
|
||||||
@ -16,7 +16,5 @@ Display active animation.
|
|||||||
````jsx
|
````jsx
|
||||||
import { Skeleton } from 'antd';
|
import { Skeleton } from 'antd';
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(<Skeleton active />, mountNode);
|
||||||
<Skeleton active />,
|
|
||||||
mountNode);
|
|
||||||
````
|
````
|
||||||
|
@ -7,16 +7,14 @@ title:
|
|||||||
|
|
||||||
## zh-CN
|
## zh-CN
|
||||||
|
|
||||||
最简单的用法。
|
最简单的占位效果。
|
||||||
|
|
||||||
## en-US
|
## en-US
|
||||||
|
|
||||||
Basic usage.
|
Simplest Skeleton usage.
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import { Skeleton } from 'antd';
|
import { Skeleton } from 'antd';
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(<Skeleton />, mountNode);
|
||||||
<Skeleton />,
|
|
||||||
mountNode);
|
|
||||||
````
|
````
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
order: 2
|
order: 3
|
||||||
title:
|
title:
|
||||||
zh-CN: 包含子组件
|
zh-CN: 包含子组件
|
||||||
en-US: Contains sub component
|
en-US: Contains sub component
|
||||||
|
20
components/skeleton/demo/complex.md
Normal file
20
components/skeleton/demo/complex.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
order: 1
|
||||||
|
title:
|
||||||
|
zh-CN: 复杂的组合
|
||||||
|
en-US: Complex combination
|
||||||
|
---
|
||||||
|
|
||||||
|
## zh-CN
|
||||||
|
|
||||||
|
更复杂的组合。
|
||||||
|
|
||||||
|
## en-US
|
||||||
|
|
||||||
|
Complex combination with avatar and multiple paragraphs.
|
||||||
|
|
||||||
|
````jsx
|
||||||
|
import { Skeleton } from 'antd';
|
||||||
|
|
||||||
|
ReactDOM.render(<Skeleton avatar paragraph={{ rows: 4 }} />, mountNode);
|
||||||
|
````
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
order: 3
|
order: 4
|
||||||
title:
|
title:
|
||||||
zh-CN: 列表
|
zh-CN: 列表
|
||||||
en-US: List
|
en-US: List
|
||||||
@ -60,7 +60,7 @@ class App extends React.Component {
|
|||||||
actions={!loading && [<IconText type="star-o" text="156" />, <IconText type="like-o" text="156" />, <IconText type="message" text="2" />]}
|
actions={!loading && [<IconText type="star-o" text="156" />, <IconText type="like-o" text="156" />, <IconText type="message" text="2" />]}
|
||||||
extra={!loading && <img width={272} alt="logo" src="https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLcXyDKnZfES.png" />}
|
extra={!loading && <img width={272} alt="logo" src="https://gw.alipayobjects.com/zos/rmsportal/mqaQswcyDLcXyDKnZfES.png" />}
|
||||||
>
|
>
|
||||||
<Skeleton loading={loading} active>
|
<Skeleton loading={loading} active avatar>
|
||||||
<List.Item.Meta
|
<List.Item.Meta
|
||||||
avatar={<Avatar src={item.avatar} />}
|
avatar={<Avatar src={item.avatar} />}
|
||||||
title={<a href={item.href}>{item.title}</a>}
|
title={<a href={item.href}>{item.title}</a>}
|
||||||
|
@ -39,16 +39,14 @@ function getTitleBasicProps(hasAvatar: boolean, hasParagraph: boolean): Skeleton
|
|||||||
return { width: '50%' };
|
return { width: '50%' };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { width: '100%' };
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getParagraphBasicProps(hasAvatar: boolean, hasTitle: boolean): SkeletonParagraphProps {
|
function getParagraphBasicProps(hasAvatar: boolean, hasTitle: boolean): SkeletonParagraphProps {
|
||||||
const basicProps: SkeletonParagraphProps = {};
|
const basicProps: SkeletonParagraphProps = {};
|
||||||
|
|
||||||
// Width
|
// Width
|
||||||
if (hasAvatar && hasTitle) {
|
if (!hasAvatar || !hasTitle) {
|
||||||
basicProps.width = '100%';
|
|
||||||
} else {
|
|
||||||
basicProps.width = '61%';
|
basicProps.width = '61%';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,15 @@
|
|||||||
height: 16px;
|
height: 16px;
|
||||||
background: @skeleton-color;
|
background: @skeleton-color;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
&:nth-child(3) {
|
||||||
|
width: 94%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(4) {
|
||||||
|
width: 96%;
|
||||||
|
}
|
||||||
|
|
||||||
+ li {
|
+ li {
|
||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
|
Loading…
Reference in New Issue
Block a user