add special file options to folders
This commit is contained in:
parent
fa518f028a
commit
245ca63a5d
3 changed files with 28 additions and 3 deletions
|
@ -102,6 +102,28 @@ export class FileNode extends React.Component {
|
||||||
</button>
|
</button>
|
||||||
<div ref="fileOptions" className="sidebar__file-item-options">
|
<div ref="fileOptions" className="sidebar__file-item-options">
|
||||||
<ul title="file options">
|
<ul title="file options">
|
||||||
|
{(() => { // eslint-disable-line
|
||||||
|
if (this.props.fileType === 'folder') {
|
||||||
|
return (
|
||||||
|
<li>
|
||||||
|
<a aria-label="add file" onClick={this.props.newFile} >
|
||||||
|
Add File
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})()}
|
||||||
|
{(() => { // eslint-disable-line
|
||||||
|
if (this.props.fileType === 'folder') {
|
||||||
|
return (
|
||||||
|
<li>
|
||||||
|
<a aria-label="add folder" onClick={this.props.newFolder} >
|
||||||
|
Add Folder
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})()}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -162,7 +184,9 @@ FileNode.propTypes = {
|
||||||
showEditFileName: PropTypes.func.isRequired,
|
showEditFileName: PropTypes.func.isRequired,
|
||||||
hideEditFileName: PropTypes.func.isRequired,
|
hideEditFileName: PropTypes.func.isRequired,
|
||||||
updateFileName: PropTypes.func.isRequired,
|
updateFileName: PropTypes.func.isRequired,
|
||||||
resetSelectedFile: PropTypes.func.isRequired
|
resetSelectedFile: PropTypes.func.isRequired,
|
||||||
|
newFile: PropTypes.func.isRequired,
|
||||||
|
newFolder: PropTypes.func.isRequired
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapStateToProps(state, ownProps) {
|
function mapStateToProps(state, ownProps) {
|
||||||
|
|
|
@ -45,12 +45,12 @@ class Sidebar extends React.Component {
|
||||||
</button>
|
</button>
|
||||||
<ul className="sidebar__project-options">
|
<ul className="sidebar__project-options">
|
||||||
<li>
|
<li>
|
||||||
<a onClick={this.props.newFolder} >
|
<a aria-label="add folder" onClick={this.props.newFolder} >
|
||||||
Add Folder
|
Add Folder
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a onClick={this.props.newFile} >
|
<a aria-label="add file" onClick={this.props.newFile} >
|
||||||
Add File
|
Add File
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -78,6 +78,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 95%;
|
top: 95%;
|
||||||
left: 77%;
|
left: 77%;
|
||||||
|
right: -65%;
|
||||||
display: none;
|
display: none;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
padding: #{8 / $base-font-size}rem #{16 / $base-font-size}rem;
|
padding: #{8 / $base-font-size}rem #{16 / $base-font-size}rem;
|
||||||
|
|
Loading…
Reference in a new issue