mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add eslint rule padding-line-between-statements (#1593)
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
1 parent
7b77f18376
commit
dcf253e7d5
401 files changed
+2018
-40
No files matched your search
@@ -8,9 +8,11 @@ export interface DrawerItemLabelsProps extends DrawerItemProps {
|
||||
|
||||
export function DrawerItemLabels(props: DrawerItemLabelsProps) {
|
||||
const { labels, ...itemProps } = props;
|
||||
|
||||
if (!labels || !labels.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<DrawerItem {...itemProps} labelsOnly>
|
||||
{labels.map(label => <Badge key={label} label={label} title={label}/>)}
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface DrawerItemProps extends React.HTMLAttributes<any> {
|
||||
export class DrawerItem extends React.Component<DrawerItemProps> {
|
||||
render() {
|
||||
const { name, title, labelsOnly, children, hidden, className, renderBoolean, ...elemProps } = this.props;
|
||||
|
||||
if (hidden) return null;
|
||||
|
||||
const classNames = cssNames("DrawerItem", className, { labelsOnly });
|
||||
|
||||
@@ -24,6 +24,7 @@ export class DrawerParamToggler extends React.Component<DrawerParamTogglerProps,
|
||||
const { open } = this.state;
|
||||
const icon = `arrow_drop_${open ? "up" : "down"}`;
|
||||
const link = open ? _i18n._(t`Hide`) : _i18n._(t`Show`);
|
||||
|
||||
return (
|
||||
<div className="DrawerParamToggler">
|
||||
<div className="flex gaps align-center">
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface DrawerTitleProps {
|
||||
export class DrawerTitle extends React.Component<DrawerTitleProps> {
|
||||
render() {
|
||||
const { title, children, className } = this.props;
|
||||
|
||||
return (
|
||||
<div className={cssNames("DrawerTitle", className)}>
|
||||
{title || children}
|
||||
|
||||
@@ -56,12 +56,14 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
saveScrollPos = () => {
|
||||
if (!this.scrollElem) return;
|
||||
const key = history.location.key;
|
||||
|
||||
this.scrollPos.set(key, this.scrollElem.scrollTop);
|
||||
};
|
||||
|
||||
restoreScrollPos = () => {
|
||||
if (!this.scrollElem) return;
|
||||
const key = history.location.key;
|
||||
|
||||
this.scrollElem.scrollTop = this.scrollPos.get(key) || 0;
|
||||
};
|
||||
|
||||
@@ -69,6 +71,7 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
if (!this.props.open) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (evt.code === "Escape") {
|
||||
this.close();
|
||||
}
|
||||
@@ -76,11 +79,13 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
|
||||
onClickOutside = (evt: MouseEvent) => {
|
||||
const { contentElem, mouseDownTarget, close, props: { open } } = this;
|
||||
|
||||
if (!open || evt.defaultPrevented || contentElem.contains(mouseDownTarget)) {
|
||||
return;
|
||||
}
|
||||
const clickedElem = evt.target as HTMLElement;
|
||||
const isOutsideAnyDrawer = !clickedElem.closest(".Drawer");
|
||||
|
||||
if (isOutsideAnyDrawer) {
|
||||
close();
|
||||
}
|
||||
@@ -95,12 +100,14 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
|
||||
close = () => {
|
||||
const { open, onClose } = this.props;
|
||||
|
||||
if (open) onClose();
|
||||
};
|
||||
|
||||
render() {
|
||||
const { open, position, title, animation, children, toolbar, size, usePortal } = this.props;
|
||||
let { className, contentClass } = this.props;
|
||||
|
||||
className = cssNames("Drawer", className, position);
|
||||
contentClass = cssNames("drawer-content flex column box grow", contentClass);
|
||||
const style = size ? { "--size": size } as React.CSSProperties : undefined;
|
||||
@@ -120,6 +127,7 @@ export class Drawer extends React.Component<DrawerProps> {
|
||||
</div>
|
||||
</Animate>
|
||||
);
|
||||
|
||||
return usePortal ? createPortal(drawer, document.body) : drawer;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user