mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- Add auto-update and pre-release update user settings - Add settings in user preferences for auto-updating (default false) and for allowing pre-release versions (default false) - Use in-Lens notifications instead of OS notifications as those were found to be flaky - Add rudimentary main->renderer notification system. - Remove options, always confirm, never auto prelease - Changed "yes later" to "yes on quit" - move register IpcHandlers - use moment instead of dateformat - moved formatting notification buttons to renderer - move to RenderButtons as function component - explicitly only send notifications to main view - move delay to utils, always retry even if check failed - fix notification rendering and disabled the auto-updater for integration tests - update integration runner to output logs on failure - pin minikube version Signed-off-by: Sebastian Malton <sebastian@malton.name>
63 lines
1.5 KiB
TypeScript
63 lines
1.5 KiB
TypeScript
import "./button.scss";
|
|
import React, { ButtonHTMLAttributes, ReactNode } from "react";
|
|
import { cssNames } from "../../utils";
|
|
import { TooltipDecoratorProps, withTooltip } from "../tooltip";
|
|
|
|
export interface ButtonProps extends ButtonHTMLAttributes<any>, TooltipDecoratorProps {
|
|
label?: React.ReactNode;
|
|
waiting?: boolean;
|
|
primary?: boolean;
|
|
accent?: boolean;
|
|
secondary?: boolean;
|
|
action?: boolean;
|
|
plain?: boolean;
|
|
hidden?: boolean;
|
|
active?: boolean;
|
|
big?: boolean;
|
|
round?: boolean;
|
|
href?: string; // render as hyperlink
|
|
target?: "_blank"; // in case of using @href
|
|
}
|
|
|
|
@withTooltip
|
|
export class Button extends React.PureComponent<ButtonProps, {}> {
|
|
private link: HTMLAnchorElement;
|
|
private button: HTMLButtonElement;
|
|
|
|
render() {
|
|
const {
|
|
className, waiting, label, primary, accent, plain, hidden, active, big,
|
|
round, tooltip, children, secondary, action, ...props
|
|
} = this.props;
|
|
const btnProps = props as Partial<ButtonProps>;
|
|
if (hidden) return null;
|
|
|
|
btnProps.className = cssNames('Button', className, {
|
|
waiting, primary, accent, plain, active, big, round, secondary, action,
|
|
});
|
|
|
|
const btnContent: ReactNode = (
|
|
<>
|
|
{label}
|
|
{children}
|
|
</>
|
|
);
|
|
|
|
// render as link
|
|
if (this.props.href) {
|
|
return (
|
|
<a {...btnProps} ref={e => this.link = e}>
|
|
{btnContent}
|
|
</a>
|
|
)
|
|
}
|
|
|
|
// render as button
|
|
return (
|
|
<button type="button" {...btnProps} ref={e => this.button = e}>
|
|
{btnContent}
|
|
</button>
|
|
)
|
|
}
|
|
}
|