mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Adding showButtons prop to InfoPanel
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
9f3056d706
commit
c8a83ce1fa
@ -23,7 +23,7 @@ interface OptionalProps {
|
|||||||
submitLabel?: ReactNode;
|
submitLabel?: ReactNode;
|
||||||
submittingMessage?: ReactNode;
|
submittingMessage?: ReactNode;
|
||||||
disableSubmit?: boolean;
|
disableSubmit?: boolean;
|
||||||
showSubmit?: boolean;
|
showButtons?: boolean
|
||||||
showSubmitClose?: boolean;
|
showSubmitClose?: boolean;
|
||||||
showInlineInfo?: boolean;
|
showInlineInfo?: boolean;
|
||||||
showNotifications?: boolean;
|
showNotifications?: boolean;
|
||||||
@ -34,7 +34,7 @@ export class InfoPanel extends Component<Props> {
|
|||||||
static defaultProps: OptionalProps = {
|
static defaultProps: OptionalProps = {
|
||||||
submitLabel: <Trans>Submit</Trans>,
|
submitLabel: <Trans>Submit</Trans>,
|
||||||
submittingMessage: <Trans>Submitting..</Trans>,
|
submittingMessage: <Trans>Submitting..</Trans>,
|
||||||
showSubmit: true,
|
showButtons: true,
|
||||||
showSubmitClose: true,
|
showSubmitClose: true,
|
||||||
showInlineInfo: true,
|
showInlineInfo: true,
|
||||||
showNotifications: true,
|
showNotifications: true,
|
||||||
@ -89,7 +89,7 @@ export class InfoPanel extends Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { className, controls, submitLabel, disableSubmit, error, submittingMessage, showSubmit, showSubmitClose } = this.props;
|
const { className, controls, submitLabel, disableSubmit, error, submittingMessage, showButtons, showSubmitClose } = this.props;
|
||||||
const { submit, close, submitAndClose, waiting } = this;
|
const { submit, close, submitAndClose, waiting } = this;
|
||||||
const isDisabled = !!(disableSubmit || waiting || error);
|
const isDisabled = !!(disableSubmit || waiting || error);
|
||||||
return (
|
return (
|
||||||
@ -100,24 +100,26 @@ export class InfoPanel extends Component<Props> {
|
|||||||
<div className="info flex gaps align-center">
|
<div className="info flex gaps align-center">
|
||||||
{waiting ? <><Spinner /> {submittingMessage}</> : this.renderErrorIcon()}
|
{waiting ? <><Spinner /> {submittingMessage}</> : this.renderErrorIcon()}
|
||||||
</div>
|
</div>
|
||||||
<Button plain label={<Trans>Cancel</Trans>} onClick={close} />
|
{showButtons && (
|
||||||
{showSubmit && (
|
<>
|
||||||
<Button
|
<Button plain label={<Trans>Cancel</Trans>} onClick={close} />
|
||||||
active
|
<Button
|
||||||
outlined={showSubmitClose}
|
active
|
||||||
primary={!showSubmitClose}// one button always should be primary (blue)
|
outlined={showSubmitClose}
|
||||||
label={submitLabel}
|
primary={!showSubmitClose}// one button always should be primary (blue)
|
||||||
onClick={submit}
|
label={submitLabel}
|
||||||
disabled={isDisabled}
|
onClick={submit}
|
||||||
/>
|
disabled={isDisabled}
|
||||||
)}
|
/>
|
||||||
{showSubmitClose && (
|
{showSubmitClose && (
|
||||||
<Button
|
<Button
|
||||||
primary active
|
primary active
|
||||||
label={<Trans>{submitLabel} & Close</Trans>}
|
label={<Trans>{submitLabel} & Close</Trans>}
|
||||||
onClick={submitAndClose}
|
onClick={submitAndClose}
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user