Skip to content

Moves download option into file editor #716

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

Merged
merged 2 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/BrowserCell/BrowserCell.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let BrowserCell = ({ type, value, hidden, width, current, onSelect, onEditChange
content = JSON.stringify(value);
} else if (type === 'File') {
if (value.url()) {
content = <a href={value.url()} target='_blank'><Pill value={getFileName(value)} /></a>;
content = <Pill value={getFileName(value)} />;
} else {
content = <Pill value={'Uploading\u2026'} />;
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/FileEditor/FileEditor.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ export default class FileEditor extends React.Component {
}

render() {
const file = this.props.value;
return (
<div ref='input' style={{ minWidth: this.props.width }} className={styles.editor}>
{this.props.value ? <a href='javascript:;' role='button' className={styles.delete} onClick={() => this.props.onCommit(undefined)}>Delete</a> : null}
{file && file.url() ? <a href={file.url()} target='_blank' role='button' className={styles.download}>Download</a> : null}
<a className={styles.upload}>
<input type='file' onChange={this.handleChange.bind(this)} />
<span>{this.props.value ? 'Replace file' : 'Upload file'}</span>
<span>{file ? 'Replace file' : 'Upload file'}</span>
</a>
{file ? <a href='javascript:;' role='button' className={styles.delete} onClick={() => this.props.onCommit(undefined)}>Delete</a> : null}
</div>
);
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/FileEditor/FileEditor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
padding: 6px;
}

.delete, .upload {
.delete, .upload, .download {
@include DosisFont;
display: block;
cursor: pointer;
Expand All @@ -28,13 +28,13 @@

.delete {
background: $red;
margin-bottom: 6px;
}

.upload {
.upload, .download {
position: relative;
overflow: hidden;
background: $blue;
margin-bottom: 6px;

input {
position: absolute;
Expand Down