Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 61 additions & 54 deletions src/panels/lovelace/components/hui-card-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,72 +33,79 @@ export class HuiCardOptions extends LitElement {
protected render(): TemplateResult {
return html`
<slot></slot>
<div class="options">
<div class="primary-actions">
<mwc-button @click="${this._editCard}"
>${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.edit"
)}</mwc-button
>
</div>
<div class="secondary-actions">
<paper-icon-button
title="Move card down"
class="move-arrow"
icon="hass:arrow-down"
@click="${this._cardDown}"
?disabled="${this.lovelace!.config.views[this.path![0]].cards!
.length ===
this.path![1] + 1}"
></paper-icon-button>
<paper-icon-button
title="Move card up"
class="move-arrow"
icon="hass:arrow-up"
@click="${this._cardUp}"
?disabled="${this.path![1] === 0}"
></paper-icon-button>
<paper-menu-button
horizontal-align="right"
vertical-align="bottom"
vertical-offset="40"
close-on-activate
>
<ha-card>
<div class="options">
<div class="primary-actions">
<mwc-button @click="${this._editCard}"
>${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.edit"
)}</mwc-button
>
</div>
<div class="secondary-actions">
<paper-icon-button
title="Move card down"
class="move-arrow"
icon="hass:arrow-down"
@click="${this._cardDown}"
?disabled="${this.lovelace!.config.views[this.path![0]].cards!
.length ===
this.path![1] + 1}"
></paper-icon-button>
<paper-icon-button
icon="hass:dots-vertical"
slot="dropdown-trigger"
aria-label=${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.options"
)}
title="Move card up"
class="move-arrow"
icon="hass:arrow-up"
@click="${this._cardUp}"
?disabled="${this.path![1] === 0}"
></paper-icon-button>
<paper-listbox slot="dropdown-content">
<paper-item @tap="${this._moveCard}">
${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.move"
)}</paper-item
>
<paper-item .class="delete-item" @tap="${this._deleteCard}">
${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.delete"
)}</paper-item
>
</paper-listbox>
</paper-menu-button>
<paper-menu-button
horizontal-align="right"
vertical-align="bottom"
vertical-offset="40"
close-on-activate
>
<paper-icon-button
icon="hass:dots-vertical"
slot="dropdown-trigger"
aria-label=${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.options"
)}
></paper-icon-button>
<paper-listbox slot="dropdown-content">
<paper-item @tap="${this._moveCard}">
${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.move"
)}</paper-item
>
<paper-item .class="delete-item" @tap="${this._deleteCard}">
${this.hass!.localize(
"ui.panel.lovelace.editor.edit_card.delete"
)}</paper-item
>
</paper-listbox>
</paper-menu-button>
</div>
</div>
</div>
</ha-card>
`;
}

static get styles(): CSSResult {
return css`
div.options {
border-top: 1px solid #e8e8e8;
padding: 5px 8px;
background: var(--paper-card-background-color, white);
ha-card {
border-top-right-radius: 0;
border-top-left-radius: 0;
box-shadow: rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this still needed ? Isn't this built into the card ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a different shadow from the Ha-card. It shifts the shadow down so there is no shadow on the overlapping section

rgba(0, 0, 0, 0.12) 0px 1px 5px -4px,
rgba(0, 0, 0, 0.2) 0px 3px 1px -2px;
}

div.options {
border-top: 1px solid #e8e8e8;
padding: 5px 8px;
display: flex;
margin-top: -1px;
}

div.options .primary-actions {
Expand Down