Skip to content

Commit

Permalink
feat(action-icon): add hideActions property (#752)
Browse files Browse the repository at this point in the history
* feat(action-icon): add noaction property

* test(editors/substation/l-node-editor): update snapshot

* refactor(action-icon): resolve review comments
  • Loading branch information
JakobVogelsang committed May 17, 2022
1 parent c93aea6 commit f89371f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/action-icon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export class ActionIcon extends LitElement {
/** highlight pane with dotted outline */
@property({ type: Boolean })
highlighted = false;
/** disables CSS adoption to action buttons */
@property({ type: Boolean })
hideActions = false;

async firstUpdated(): Promise<void> {
this.tabIndex = 0;
Expand Down Expand Up @@ -90,11 +93,16 @@ export class ActionIcon extends LitElement {
:host(:focus-within) mwc-icon {
outline-style: solid;
outline-width: 4px;
}
:host(:focus-within:not([hideActions])) ::slotted([slot='icon']),
:host(:focus-within:not([hideActions])) mwc-icon {
transform: scale(0.8);
transition: all 250ms linear;
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
}
::slotted([slot='icon']:hover),
mwc-icon:hover {
outline-style: dashed;
Expand Down Expand Up @@ -177,6 +185,10 @@ export class ActionIcon extends LitElement {
opacity 200ms linear;
}
:host([secondary]) header {
background-color: var(--mdc-theme-secondary);
}
:host(:hover) header {
position: absolute;
opacity: 1;
Expand All @@ -190,11 +202,18 @@ export class ActionIcon extends LitElement {
:host(:focus-within) header {
position: absolute;
opacity: 1;
transform: translate(0, -80px);
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.2);
transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1),
opacity 250ms linear;
}
:host(:focus-within:not([hideActions])) header {
transform: translate(0, -80px);
}
:host(:focus-within[hideActions]) header {
transform: translate(0, -40px);
}
`;
}
1 change: 1 addition & 0 deletions src/editors/substation/l-node-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class LNodeEditor extends LitElement {
label="${this.header}"
?secondary=${this.missingIedReference}
?highlighted=${this.missingIedReference}
hideActions
><mwc-icon slot="icon"
>${getLNodeIcon(this.element)}</mwc-icon
></action-icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const snapshots = {};

snapshots["web component rendering LNode element as reference to a LN/LN0 within IED looks like the latest snapshot"] =
`<action-icon
hideactions=""
label="IED1 CircuitBreaker_CB1/ XCBR 1"
tabindex="0"
>
Expand All @@ -14,6 +15,7 @@ snapshots["web component rendering LNode element as reference to a LN/LN0 within

snapshots["web component rendering LNode element as instance of a LNodeType only looks like the latest snapshot"] =
`<action-icon
hideactions=""
highlighted=""
label="DC XSWI 1"
secondary=""
Expand Down

0 comments on commit f89371f

Please sign in to comment.