redesign for fileSelector component

This commit is contained in:
btzr-io 2017-10-02 21:04:21 -06:00
parent 28f4b98e20
commit 59778808e3
2 changed files with 25 additions and 3 deletions

View file

@ -12,6 +12,11 @@ class FileSelector extends React.PureComponent {
type: "file",
};
constructor(props) {
super(props);
this._inputElem = null;
}
componentWillMount() {
this.setState({
path: this.props.initPath || null,
@ -47,7 +52,7 @@ class FileSelector extends React.PureComponent {
<div className="file-selector">
<button
type="button"
className="file-selector__choose-button"
className="button-block button-alt file-selector__choose-button"
onClick={() => this.handleButtonClick()}
>
{this.props.type == "file"
@ -56,7 +61,18 @@ class FileSelector extends React.PureComponent {
</button>
{" "}
<span className="file-selector__path">
{this.state.path ? this.state.path : __("No File Chosen")}
<input
className="input-copyable"
type="text"
ref={input => {
this._inputElem = input;
}}
onFocus={() => {
this._inputElem.select();
}}
readOnly="readonly"
value={this.state.path || __("No File Chosen")}
/>
</span>
</div>
);

View file

@ -1,5 +1,11 @@
.file-selector {
display: flex;
}
.file-selector__choose-button {
font-size: 13px;
font-family: inherit;
margin-right: 16px;
padding: 0 16px;
}
.file-selector__path {