-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
390 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import {Button, Modal, ModalHeader, ModalBody, ModalFooter, Input} from 'reactstrap'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
import {isDarkTheme} from '../utils/utils'; | ||
|
||
class AddFileModal extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = {modal: false, filename: ''}; | ||
} | ||
|
||
toggle() { | ||
this.setState({modal: !this.state.modal}); | ||
} | ||
|
||
handleChange(event) { | ||
this.setState({filename: event.target.value}); | ||
} | ||
|
||
addFile() { | ||
this.props.saveFile({path: `${this.props.node.path}/${this.state.filename}`, content: ''}); | ||
this.toggle(); | ||
} | ||
|
||
render() { | ||
return ( | ||
<Modal contentClassName={classNames({'dark-theme': isDarkTheme(this.props.theme)})} | ||
isOpen={this.state.modal} | ||
toggle={() => this.toggle()}> | ||
<ModalHeader toggle={() => this.toggle()}>Please give the file a name</ModalHeader> | ||
<ModalBody> | ||
<Input autofocus="true" value={this.state.filename} onChange={e => this.handleChange(e)} /> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="primary" onClick={() => this.addFile()}>Add File</Button>{' '} | ||
<Button color="secondary" onClick={() => this.toggle()}>Cancel</Button> | ||
</ModalFooter> | ||
</Modal> | ||
) | ||
} | ||
} | ||
|
||
AddFileModal.propTypes = { | ||
saveFile: PropTypes.func, | ||
node: PropTypes.object, | ||
theme: PropTypes.string | ||
}; | ||
|
||
export default AddFileModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import {Button, Modal, ModalHeader, ModalBody, ModalFooter, Input} from 'reactstrap'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
import {isDarkTheme} from '../utils/utils'; | ||
|
||
class AddFolderModal extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = {modal: false, folder: ''}; | ||
} | ||
|
||
toggle() { | ||
this.setState({modal: !this.state.modal}); | ||
} | ||
|
||
handleChange(event) { | ||
this.setState({folder: event.target.value}); | ||
} | ||
|
||
addFolder() { | ||
this.props.saveFolder({path: `${this.props.node.path}/${this.state.folder}`}); | ||
this.toggle(); | ||
} | ||
|
||
render() { | ||
return ( | ||
<Modal contentClassName={classNames({'dark-theme': isDarkTheme(this.props.theme)})} | ||
isOpen={this.state.modal} | ||
toggle={() => this.toggle()}> | ||
<ModalHeader toggle={() => this.toggle()}>Please give the folder a name</ModalHeader> | ||
<ModalBody> | ||
<Input autofocus="true" value={this.state.filename} onChange={e => this.handleChange(e)} /> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="primary" onClick={() => this.addFolder()}>Add Folder</Button>{' '} | ||
<Button color="secondary" onClick={() => this.toggle()}>Cancel</Button> | ||
</ModalFooter> | ||
</Modal> | ||
) | ||
} | ||
} | ||
|
||
AddFolderModal.propTypes = { | ||
saveFolder: PropTypes.func, | ||
node: PropTypes.object, | ||
theme: PropTypes.string | ||
}; | ||
|
||
export default AddFolderModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.