1
0
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:
Alex Andreev 2020-10-07 13:20:09 +03:00
parent 9f3056d706
commit c8a83ce1fa

View File

@ -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,8 +100,9 @@ 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>
{showButtons && (
<>
<Button plain label={<Trans>Cancel</Trans>} onClick={close} /> <Button plain label={<Trans>Cancel</Trans>} onClick={close} />
{showSubmit && (
<Button <Button
active active
outlined={showSubmitClose} outlined={showSubmitClose}
@ -110,7 +111,6 @@ export class InfoPanel extends Component<Props> {
onClick={submit} onClick={submit}
disabled={isDisabled} disabled={isDisabled}
/> />
)}
{showSubmitClose && ( {showSubmitClose && (
<Button <Button
primary active primary active
@ -119,6 +119,8 @@ export class InfoPanel extends Component<Props> {
disabled={isDisabled} disabled={isDisabled}
/> />
)} )}
</>
)}
</div> </div>
); );
} }