allow custom labels in file-selector
This commit is contained in:
parent
c7a91340dc
commit
de8f116709
1 changed files with 7 additions and 6 deletions
|
@ -9,6 +9,8 @@ type Props = {
|
||||||
type: string,
|
type: string,
|
||||||
currentPath: ?string,
|
currentPath: ?string,
|
||||||
onFileChosen: (string, string) => void,
|
onFileChosen: (string, string) => void,
|
||||||
|
fileLabel: ?string,
|
||||||
|
directoryLabel: ?string,
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileSelector extends React.PureComponent<Props> {
|
class FileSelector extends React.PureComponent<Props> {
|
||||||
|
@ -47,15 +49,14 @@ class FileSelector extends React.PureComponent<Props> {
|
||||||
input: ?HTMLInputElement;
|
input: ?HTMLInputElement;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { type, currentPath } = this.props;
|
const { type, currentPath, fileLabel, directoryLabel } = this.props;
|
||||||
|
|
||||||
|
const label =
|
||||||
|
type === 'file' ? fileLabel || __('Choose File') : directoryLabel || __('Choose Directory');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormRow verticallyCentered padded>
|
<FormRow verticallyCentered padded>
|
||||||
<Button
|
<Button button="primary" onClick={() => this.handleButtonClick()} label={label} />
|
||||||
button="primary"
|
|
||||||
onClick={() => this.handleButtonClick()}
|
|
||||||
label={type === 'file' ? __('Choose File') : __('Choose Directory')}
|
|
||||||
/>
|
|
||||||
<input
|
<input
|
||||||
webkitdirectory="true"
|
webkitdirectory="true"
|
||||||
className="input-copyable"
|
className="input-copyable"
|
||||||
|
|
Loading…
Add table
Reference in a new issue