Skip to content

Commit

Permalink
update upload detail
Browse files Browse the repository at this point in the history
  • Loading branch information
afc163 committed Nov 22, 2016
1 parent f77d568 commit e552880
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
15 changes: 8 additions & 7 deletions components/upload/demo/inplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Demo = React.createClass({
if (info.file.status === 'done') {
this.setState({
// Get this url from response in real world.
imageUrl: 'https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg',
imageUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
});
}
},
Expand Down Expand Up @@ -52,21 +52,22 @@ ReactDOM.render(<Demo />, mountNode);
```

```css
#components-upload-demo-inplace .avatar-uploader,
#components-upload-demo-inplace .avatar-uploader-trigger,
#components-upload-demo-inplace .avatar {
.avatar-uploader,
.avatar-uploader-trigger,
.avatar {
width: 150px;
height: 150px;
}
#components-upload-demo-inplace .avatar-uploader {
.avatar-uploader {
display: block;
border: 1px solid #d9d9d9;
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
}
#components-upload-demo-inplace .avatar-uploader-trigger {
.avatar-uploader-trigger {
display: table-cell;
vertical-align: middle;
font-size: 28px;
color: #999;
}
```
15 changes: 10 additions & 5 deletions components/upload/demo/picture-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const ImageUploadList = React.createClass({
uid: -1,
name: 'xxx.png',
status: 'done',
url: 'https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png',
thumbUrl: 'https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
}],
onPreview: (file) => {
this.setState({
Expand All @@ -52,12 +52,17 @@ const ImageUploadList = React.createClass({
<Icon type="plus" />
<div className="ant-upload-text">Upload</div>
</Upload>
<a href="https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png" target="_blank" rel="noopener noreferrer" className="upload-example">
<img alt="example" src="https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png" />
<a
href="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
target="_blank"
rel="noopener noreferrer"
className="upload-example"
>
<img alt="example" src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" />
<span>sample</span>
</a>
<Modal visible={this.state.previewVisible} footer={null} onCancel={this.handleCancel}>
<img alt="example" src={this.state.previewImage} />
<img alt="example" style={{ width: '100%' }} src={this.state.previewImage} />
</Modal>
</div>
);
Expand Down
8 changes: 4 additions & 4 deletions components/upload/demo/picture-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ const props = {
uid: -1,
name: 'xxx.png',
status: 'done',
url: 'https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png',
thumbUrl: 'https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
}, {
uid: -2,
name: 'yyy.png',
status: 'done',
url: 'https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png',
thumbUrl: 'https://os.alipayobjects.com/rmsportal/NDbkJhpzmLxtPhB.png',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
thumbUrl: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
}],
};

Expand Down
4 changes: 3 additions & 1 deletion components/upload/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@
width: 48px;
height: 48px;
display: block;
overflow: hidden;
border-radius: @border-radius-sm;
}

.@{upload-item}-thumbnail.@{iconfont-css-prefix}:before {
Expand All @@ -221,7 +223,7 @@
text-overflow: ellipsis;
white-space: nowrap;
margin: 0 0 0 8px;
line-height: 42px;
line-height: 44px;
transition: all 0.3s ease;
padding-left: 48px;
padding-right: 8px;
Expand Down
11 changes: 5 additions & 6 deletions components/upload/uploadList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ export default class UploadList extends React.Component<UploadListProps, any> {
}

handlePreview = (file, e) => {
e.preventDefault();
const onPreview = this.props.onPreview;
const { onPreview } = this.props;
if (!onPreview) {
return;
}

e.preventDefault();
return onPreview(file);
}

Expand Down Expand Up @@ -81,7 +80,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
<a
className={`${prefixCls}-list-item-thumbnail`}
onClick={e => this.handlePreview(file, e)}
href={file.url}
href={file.thumbUrl || file.url}
target="_blank" rel="noopener noreferrer"
>
<img src={file.thumbUrl || file.url} alt={file.name} />
Expand Down Expand Up @@ -137,9 +136,9 @@ export default class UploadList extends React.Component<UploadListProps, any> {
>
<Icon type="eye-o" />
</a>
<Icon type="delete" onClick={() => this.handleClose(file)} />
<Icon type="delete" title="Remove file" onClick={() => this.handleClose(file)} />
</span>
) : <Icon type="cross" onClick={() => this.handleClose(file)} />
) : <Icon type="cross" title="Remove file" onClick={() => this.handleClose(file)} />
}
</div>
{progress}
Expand Down

0 comments on commit e552880

Please sign in to comment.