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,
|
||||
currentPath: ?string,
|
||||
onFileChosen: (string, string) => void,
|
||||
fileLabel: ?string,
|
||||
directoryLabel: ?string,
|
||||
};
|
||||
|
||||
class FileSelector extends React.PureComponent<Props> {
|
||||
|
@ -47,15 +49,14 @@ class FileSelector extends React.PureComponent<Props> {
|
|||
input: ?HTMLInputElement;
|
||||
|
||||
render() {
|
||||
const { type, currentPath } = this.props;
|
||||
const { type, currentPath, fileLabel, directoryLabel } = this.props;
|
||||
|
||||
const label =
|
||||
type === 'file' ? fileLabel || __('Choose File') : directoryLabel || __('Choose Directory');
|
||||
|
||||
return (
|
||||
<FormRow verticallyCentered padded>
|
||||
<Button
|
||||
button="primary"
|
||||
onClick={() => this.handleButtonClick()}
|
||||
label={type === 'file' ? __('Choose File') : __('Choose Directory')}
|
||||
/>
|
||||
<Button button="primary" onClick={() => this.handleButtonClick()} label={label} />
|
||||
<input
|
||||
webkitdirectory="true"
|
||||
className="input-copyable"
|
||||
|
|
Loading…
Add table
Reference in a new issue