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
aria-label="add file"
onClick={() => {
this.props.newFile(this.props.id);
setTimeout(() => this.hideFileOptions(), 0);
}}
onBlur={this.onBlurComponent}
onFocus={this.onFocusComponent}
className="sidebar__file-item-option"
>
Add File
</button>
</li>
);
}
})()}
{(() => { // eslint-disable-line
if (this.props.fileType === 'folder') {
return (
<li> <li>
<button <button
aria-label="add folder" aria-label="add folder"
onClick={() => { onClick={() => {
this.props.newFolder(this.props.id); this.props.newFolder(this.props.id);
setTimeout(() => this.hideFileOptions(), 0); setTimeout(this.hideFileOptions, 0);
}} }}
onBlur={this.onBlurComponent} onBlur={this.onBlurComponent}
onFocus={this.onFocusComponent} onFocus={this.onFocusComponent}
className="sidebar__file-item-option" className="sidebar__file-item-option"
> >
Add Folder Create folder
</button> </button>
</li> </li>
<li>
<button
aria-label="add file"
onClick={() => {
this.props.newFile(this.props.id);
setTimeout(this.hideFileOptions, 0);
}}
onBlur={this.onBlurComponent}
onFocus={this.onFocusComponent}
className="sidebar__file-item-option"
>
Create file
</button>
</li>
<li>
<button
aria-label="upload file"
onClick={() => {
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 = {