Enforce semicolons in eslint

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti committed 2020-11-19 16:35:04 +02:00
1 parent 0f3f5611ba
commit 1477bb8274
531 files changed
+3979 -3975

No files matched your search

@@ -15,5 +15,5 @@ export function DrawerItemLabels(props: DrawerItemLabelsProps) {
<DrawerItem {...itemProps} labelsOnly>
{labels.map(label => <Badge key={label} label={label} title={label}/>)}
</DrawerItem>
)
);
}
@@ -13,17 +13,17 @@ 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 { name, title, labelsOnly, children, hidden, className, renderBoolean, ...elemProps } = this.props;
if (hidden) return null;
const classNames = cssNames("DrawerItem", className, { labelsOnly });
const content = displayBooleans(renderBoolean, children)
const content = displayBooleans(renderBoolean, children);
return (
<div {...elemProps} className={classNames} title={title}>
<span className="name">{name}</span>
<span className="value">{content}</span>
</div>
)
);
}
}
@@ -16,14 +16,14 @@ export class DrawerParamToggler extends React.Component<DrawerParamTogglerProps,
public state: State = {}
toggle = () => {
this.setState({ open: !this.state.open })
this.setState({ open: !this.state.open });
}
render() {
const { label, children } = this.props
const { open } = this.state
const icon = `arrow_drop_${open ? "up" : "down"}`
const link = open ? _i18n._(t`Hide`) : _i18n._(t`Show`)
const { label, children } = this.props;
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">
@@ -35,6 +35,6 @@ export class DrawerParamToggler extends React.Component<DrawerParamTogglerProps,
</div>
<div className={cssNames("param-content", { open })}>{children}</div>
</div>
)
);
}
}
@@ -9,11 +9,11 @@ export interface DrawerTitleProps {
export class DrawerTitle extends React.Component<DrawerTitleProps> {
render() {
const { title, children, className } = this.props
const { title, children, className } = this.props;
return (
<div className={cssNames("DrawerTitle", className)}>
{title || children}
</div>
)
);
}
}
+13 -13
View File
@@ -41,16 +41,16 @@ export class Drawer extends React.Component<DrawerProps> {
componentDidMount() {
// Using window target for events to make sure they will be catched after other places (e.g. Dialog)
window.addEventListener("mousedown", this.onMouseDown)
window.addEventListener("click", this.onClickOutside)
window.addEventListener("keydown", this.onEscapeKey)
window.addEventListener("mousedown", this.onMouseDown);
window.addEventListener("click", this.onClickOutside);
window.addEventListener("keydown", this.onEscapeKey);
}
componentWillUnmount() {
this.stopListenLocation();
window.removeEventListener("mousedown", this.onMouseDown)
window.removeEventListener("click", this.onClickOutside)
window.removeEventListener("keydown", this.onEscapeKey)
window.removeEventListener("mousedown", this.onMouseDown);
window.removeEventListener("click", this.onClickOutside);
window.removeEventListener("keydown", this.onEscapeKey);
}
saveScrollPos = () => {
@@ -75,31 +75,31 @@ export class Drawer extends React.Component<DrawerProps> {
}
onClickOutside = (evt: MouseEvent) => {
const { contentElem, mouseDownTarget, close, props: { open } } = this
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()
close();
}
this.mouseDownTarget = null
this.mouseDownTarget = null;
}
onMouseDown = (evt: MouseEvent) => {
if (this.props.open) {
this.mouseDownTarget = evt.target as HTMLElement
this.mouseDownTarget = evt.target as HTMLElement;
}
}
close = () => {
const { open, onClose } = this.props
const { open, onClose } = this.props;
if (open) onClose();
}
render() {
const { open, position, title, animation, children, toolbar, size, usePortal } = this.props
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);
@@ -119,7 +119,7 @@ export class Drawer extends React.Component<DrawerProps> {
</div>
</div>
</Animate>
)
);
return usePortal ? createPortal(drawer, document.body) : drawer;
}
}
+5 -5
View File
@@ -1,5 +1,5 @@
export * from "./drawer"
export * from "./drawer-title"
export * from "./drawer-item"
export * from "./drawer-item-labels"
export * from "./drawer-param-toggler"
export * from "./drawer";
export * from "./drawer-title";
export * from "./drawer-item";
export * from "./drawer-item-labels";
export * from "./drawer-param-toggler";