Fixes #1361 - upload option missing for folder

This commit is contained in:
Cassie Tarakajian 2020-04-08 16:18:10 -04:00
parent 2aac7410d8
commit 31ca964bb7

View file

@ -185,40 +185,50 @@ export class FileNode extends React.Component {
{(() => { // eslint-disable-line {(() => { // eslint-disable-line
if (this.props.fileType === 'folder') { if (this.props.fileType === 'folder') {
return ( return (
<li> <React.Fragment>
<button <li>
aria-label="add file" <button
onClick={() => { aria-label="add folder"
this.props.newFile(this.props.id); onClick={() => {
setTimeout(() => this.hideFileOptions(), 0); this.props.newFolder(this.props.id);
}} setTimeout(this.hideFileOptions, 0);
onBlur={this.onBlurComponent} }}
onFocus={this.onFocusComponent} onBlur={this.onBlurComponent}
className="sidebar__file-item-option" onFocus={this.onFocusComponent}
> className="sidebar__file-item-option"
Add File >
</button> Create folder
</li> </button>
); </li>
} <li>
})()} <button
{(() => { // eslint-disable-line aria-label="add file"
if (this.props.fileType === 'folder') { onClick={() => {
return ( this.props.newFile(this.props.id);
<li> setTimeout(this.hideFileOptions, 0);
<button }}
aria-label="add folder" onBlur={this.onBlurComponent}
onClick={() => { onFocus={this.onFocusComponent}
this.props.newFolder(this.props.id); className="sidebar__file-item-option"
setTimeout(() => this.hideFileOptions(), 0); >
}} Create file
onBlur={this.onBlurComponent} </button>
onFocus={this.onFocusComponent} </li>
className="sidebar__file-item-option" <li>
> <button
Add Folder aria-label="upload file"
</button> onClick={() => {
</li> this.props.openUploadFileModal(this.props.id);
setTimeout(this.hideFileOptions, 0);
}}
onBlur={this.onBlurComponent}
onFocus={this.onFocusComponent}
>
Upload file
</button>
</li>
</React.Fragment>
); );
} }
})()} })()}
@ -289,7 +299,8 @@ FileNode.propTypes = {
newFolder: PropTypes.func.isRequired, newFolder: PropTypes.func.isRequired,
showFolderChildren: PropTypes.func.isRequired, showFolderChildren: PropTypes.func.isRequired,
hideFolderChildren: PropTypes.func.isRequired, hideFolderChildren: PropTypes.func.isRequired,
canEdit: PropTypes.bool.isRequired canEdit: PropTypes.bool.isRequired,
openUploadFileModal: PropTypes.func.isRequired
}; };
FileNode.defaultProps = { FileNode.defaultProps = {