mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-09 10:59:50 +00:00
Add and fix stylistic eslint rules (#23735)
* Fix stylistic eslint rules * Fix eslint issues
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||
import type { TemplateResult } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { ifDefined } from "lit/directives/if-defined";
|
||||
@@ -25,83 +25,81 @@ export class HaControlButton extends LitElement {
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
return css`
|
||||
:host {
|
||||
display: block;
|
||||
--control-button-icon-color: var(--primary-text-color);
|
||||
--control-button-background-color: var(--disabled-color);
|
||||
--control-button-background-opacity: 0.2;
|
||||
--control-button-border-radius: 10px;
|
||||
--control-button-padding: 8px;
|
||||
--mdc-icon-size: 20px;
|
||||
--ha-ripple-color: var(--secondary-text-color);
|
||||
color: var(--primary-text-color);
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.button {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: var(--control-button-border-radius);
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: var(--control-button-padding);
|
||||
box-sizing: border-box;
|
||||
line-height: inherit;
|
||||
font-family: Roboto;
|
||||
font-weight: 500;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
background: none;
|
||||
/* For safari border-radius overflow */
|
||||
z-index: 0;
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
.button:focus-visible {
|
||||
--control-button-background-opacity: 0.4;
|
||||
}
|
||||
.button::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: var(--control-button-background-color);
|
||||
transition:
|
||||
background-color 180ms ease-in-out,
|
||||
opacity 180ms ease-in-out;
|
||||
opacity: var(--control-button-background-opacity);
|
||||
pointer-events: none;
|
||||
white-space: normal;
|
||||
}
|
||||
.button {
|
||||
transition: color 180ms ease-in-out;
|
||||
color: var(--control-button-icon-color);
|
||||
}
|
||||
.button ::slotted(*) {
|
||||
pointer-events: none;
|
||||
opacity: 0.95;
|
||||
}
|
||||
.button:disabled {
|
||||
cursor: not-allowed;
|
||||
--control-button-background-color: var(--disabled-color);
|
||||
--control-button-icon-color: var(--disabled-text-color);
|
||||
--control-button-background-opacity: 0.2;
|
||||
}
|
||||
`;
|
||||
}
|
||||
static styles = css`
|
||||
:host {
|
||||
display: block;
|
||||
--control-button-icon-color: var(--primary-text-color);
|
||||
--control-button-background-color: var(--disabled-color);
|
||||
--control-button-background-opacity: 0.2;
|
||||
--control-button-border-radius: 10px;
|
||||
--control-button-padding: 8px;
|
||||
--mdc-icon-size: 20px;
|
||||
--ha-ripple-color: var(--secondary-text-color);
|
||||
color: var(--primary-text-color);
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
.button {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: var(--control-button-border-radius);
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: var(--control-button-padding);
|
||||
box-sizing: border-box;
|
||||
line-height: inherit;
|
||||
font-family: Roboto;
|
||||
font-weight: 500;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
background: none;
|
||||
/* For safari border-radius overflow */
|
||||
z-index: 0;
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
.button:focus-visible {
|
||||
--control-button-background-opacity: 0.4;
|
||||
}
|
||||
.button::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background-color: var(--control-button-background-color);
|
||||
transition:
|
||||
background-color 180ms ease-in-out,
|
||||
opacity 180ms ease-in-out;
|
||||
opacity: var(--control-button-background-opacity);
|
||||
pointer-events: none;
|
||||
white-space: normal;
|
||||
}
|
||||
.button {
|
||||
transition: color 180ms ease-in-out;
|
||||
color: var(--control-button-icon-color);
|
||||
}
|
||||
.button ::slotted(*) {
|
||||
pointer-events: none;
|
||||
opacity: 0.95;
|
||||
}
|
||||
.button:disabled {
|
||||
cursor: not-allowed;
|
||||
--control-button-background-color: var(--disabled-color);
|
||||
--control-button-icon-color: var(--disabled-text-color);
|
||||
--control-button-background-opacity: 0.2;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
||||
Reference in New Issue
Block a user