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
@@ -32,6 +32,7 @@ export class Icon extends React.PureComponent<IconProps> {
|
||||
|
||||
get isInteractive() {
|
||||
const { interactive, onClick, href, link } = this.props;
|
||||
|
||||
return interactive ?? !!(onClick || href || link);
|
||||
}
|
||||
|
||||
@@ -40,6 +41,7 @@ export class Icon extends React.PureComponent<IconProps> {
|
||||
if (this.props.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.props.onClick) {
|
||||
this.props.onClick(evt);
|
||||
}
|
||||
@@ -49,14 +51,17 @@ export class Icon extends React.PureComponent<IconProps> {
|
||||
onKeyDown(evt: React.KeyboardEvent<any>) {
|
||||
switch (evt.nativeEvent.code) {
|
||||
case "Space":
|
||||
|
||||
case "Enter": {
|
||||
// eslint-disable-next-line react/no-find-dom-node
|
||||
const icon = findDOMNode(this) as HTMLElement;
|
||||
|
||||
setTimeout(() => icon.click());
|
||||
evt.preventDefault();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.props.onKeyDown) {
|
||||
this.props.onKeyDown(evt);
|
||||
}
|
||||
@@ -90,6 +95,7 @@ export class Icon extends React.PureComponent<IconProps> {
|
||||
// render as inline svg-icon
|
||||
if (svg) {
|
||||
const svgIconText = require(`!!raw-loader!./${svg}.svg`).default;
|
||||
|
||||
iconContent = <span className="icon" dangerouslySetInnerHTML={{ __html: svgIconText }}/>;
|
||||
}
|
||||
|
||||
@@ -110,9 +116,11 @@ export class Icon extends React.PureComponent<IconProps> {
|
||||
if (link) {
|
||||
return <NavLink {...iconProps} to={link}/>;
|
||||
}
|
||||
|
||||
if (href) {
|
||||
return <a {...iconProps} href={href}/>;
|
||||
}
|
||||
|
||||
return <i {...iconProps} />;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user