Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(chip): improve stack in card support #502

Merged
merged 1 commit into from May 17, 2022
Merged

Conversation

piitaya
Copy link
Owner

@piitaya piitaya commented May 17, 2022

Description

Convert chip to standard ha-card. This improve support for card like vertical-stack-in-card because the container element is a ha-card.

Example :

image

type: custom:vertical-stack-in-card
styles:
  '--chip-box-shadow': none
  '--chip-background': none
  '--chip-spacing': 0
cards:
  - type: custom:mushroom-light-card
    entity: light.bed_light
  - type: custom:mushroom-chips-card
    alignment: justify
    chips:
      - type: entity
        entity: sensor.outside_temperature
        icon_color: red
      - type: entity
        entity: sensor.iphone_de_paul_battery_level
        icon_color: grey

Related Issue

Motivation and Context

How Has This Been Tested

Types of changes

  • 馃悰 Bug fix (non-breaking change which fixes an issue)
  • 馃殌 New feature (non-breaking change which adds functionality)
  • 馃寧 Translation (addition or update a translation)
  • 鈿狅笍 Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have tested the change locally.

@piitaya piitaya changed the title feat(chip): convert chips-card to ha-card feat(chip): improve stack in card support May 17, 2022
@piitaya piitaya added the enhancement New feature or request label May 17, 2022
@piitaya piitaya merged commit 2990688 into main May 17, 2022
@piitaya piitaya deleted the feat/chips-ha-card branch May 17, 2022 20:49
@Jmjm80
Copy link

Jmjm80 commented May 19, 2022

Im havent an issue with a custom theme:

Chips background still shows: (by the way, i really all the great work you're doing)
SCR-20220519-10a

@piitaya
Copy link
Owner Author

piitaya commented May 19, 2022

Have you added this options to vertical stack in card?

styles:
  '--chip-box-shadow': none
  '--chip-background': none
  '--chip-spacing': 0

@Jmjm80
Copy link

Jmjm80 commented May 19, 2022

Yes, I did.

FE7F3D41-EBDF-4C52-86D6-0CDFB4B3CAEE

@piitaya
Copy link
Owner Author

piitaya commented May 19, 2022

And what is your Mushroom version?

@Jmjm80
Copy link

Jmjm80 commented May 19, 2022

V1.8.7

@Idan37S
Copy link

Idan37S commented May 19, 2022

Yes, I did.

FE7F3D41-EBDF-4C52-86D6-0CDFB4B3CAEE

You are using stack-in-card,
Try using vertical-stack-in-card (it's another custom card) and it will probably work (the same happened to me, now it's working)

@GitHubGoody
Copy link

Same issue here in the top-left corner (and many other cards)...
image

I'm on v1.8.7 and was previously able to use...

style: |
  ha-card {box-shadow: 0px 0px;}

...to remove the border shadow on Mushroom Chips in stack-in-cards (not vertical-stack-in-cards as I see in the previous post).

Considering stack-in-cards are meant to work in vertical or horizontal mode since they were meant to replace vertical-stack-in-cards...

image

...I'd still like to figure out the proper syntax and/or request a change in Mushroom Chip Cards to make them compatible again. I think it'll be great to not have to remove the border for each chip card once I can get it working. ;-)

Here's the syntax I'm trying (I've also tried putting '0px 0px' in place of 'none' for the box-shadow property...didn't work):

- type: custom:stack-in-card
  mode: vertical
  styles:
    '--chip-box-shadow': none
    '--chip-background': none
    '--chip-spacing': 0
  cards:
      # Status Chips
    - type: custom:mushroom-chips-card
      chips:
        - type: template
          entity: binary_sensor.study_occupancy
          icon: >-
            {{ iif(is_state('binary_sensor.study_occupancy','on'),
            'mdi:account-check', 'mdi:account-cancel-outline') }}
          icon_color: '{{ iif(is_state(''binary_sensor.study_occupancy'',''on''), ''green'', ''grey'') }}'
          tap_action:
            action: more-info

I appreciate any help.

@piitaya
Copy link
Owner Author

piitaya commented May 19, 2022

One example with stack-in-card. We need to use card_mod :

type: custom:stack-in-card
cards:
  - type: custom:mushroom-chips-card
    card_mod: 
      style: |
        ha-card {
          --chip-box-shadow: none;
          --chip-background: none;
          --chip-spacing: 0;
        }
    chips:
      - type: entity
        entity: sensor.outside_temperature
        icon_color: red
      - type: light
        entity: light.bed_light

@smiller171
Copy link
Contributor

smiller171 commented May 19, 2022

card_mod still isn't doing it for me. Drop shadow won't go away

image

@smiller171
Copy link
Contributor

Ok, I didn't initially realize that card-mod was something I needed to install. After getting it set up it still didn't work as @piitaya described. This is what I finally got to work:

type: custom:stack-in-card
mode: vertical
card_mod:
  style:
    "hui-vertical-stack-card$ mushroom-chips-card":
      "$ *":
        "$ mushroom-chip$": |
          ha-card {
            --ha-card-box-shadow: none;
          }
cards:
  - type: custom:mushroom-title-card
    title: Front Door
    alignment: center
    subtitle: ''
  - type: custom:mushroom-chips-card
    chips:
      - type: entity
        entity: lock.front_door_lock
      - type: entity
        entity: sensor.doorbell_last_motion
        icon: mdi:motion-sensor
      - type: entity
        entity: sensor.doorbell_last_ding
        icon: mdi:bell-ring-outline
      - type: alarm-control-panel
        entity: alarm_control_panel.home_alarm
    alignment: center

image

@piitaya
Copy link
Owner Author

piitaya commented May 19, 2022

It's strange that the code I propose doesn't work for you...
Can you try again with 1.8.8 mushroom version and card_mod installed?

@smiller171
Copy link
Contributor

Here you go, default theme with mushroom 1.8.8

type: custom:stack-in-card
mode: vertical
cards:
  - type: custom:mushroom-title-card
    title: Front Door
    alignment: center
    subtitle: ''
  - type: custom:mushroom-chips-card
    card_mod:
      style: |
        ha-card {
          --chip-box-shadow: none;
          --chip-background: none;
          --chip-spacing: 0;
        }
    chips:
      - type: entity
        entity: sensor.doorbell_last_motion
        icon: mdi:motion-sensor
      - type: entity
        entity: sensor.doorbell_last_ding
        icon: mdi:bell-ring-outline
    alignment: center
  - type: custom:mushroom-chips-card
    card_mod:
      style: |
        ha-card {
          --chip-box-shadow: none;
          --chip-background: none;
          --chip-spacing: 0;
        }
    chips:
      - type: entity
        entity: lock.front_door_lock
      - type: alarm-control-panel
        entity: alarm_control_panel.home_alarm
    alignment: center

image

@piitaya
Copy link
Owner Author

piitaya commented May 19, 2022

Which browser do you use?

I just replaced the sensor entities and it work for me (tested on Safari and Chrome)
image

type: custom:stack-in-card
mode: vertical
cards:
  - type: custom:mushroom-title-card
    title: Front Door
    alignment: center
    subtitle: ''
  - type: custom:mushroom-chips-card
    card_mod:
      style: |
        ha-card {
          --chip-box-shadow: none;
          --chip-background: none;
          --chip-spacing: 0;
        }
    chips:
      - type: entity
        entity: sensor.outside_temperature
        icon: mdi:motion-sensor
      - type: entity
        entity: binary_sensor.basement_floor_wet
        icon: mdi:bell-ring-outline
    alignment: center
  - type: custom:mushroom-chips-card
    card_mod:
      style: |
        ha-card {
          --chip-box-shadow: none;
          --chip-background: none;
          --chip-spacing: 0;
        }
    chips:
      - type: entity
        entity: lock.front_door
      - type: alarm-control-panel
        entity: alarm_control_panel.alarm_panel_1
    alignment: center

@smiller171
Copy link
Contributor

Using Chrome on MacOS with HASS running on RasPi. I wonder if there's CSS added by another extension breaking it for me?

@piitaya
Copy link
Owner Author

piitaya commented May 20, 2022

Maybe. I only have card_mod and stack-in-card installed on my test env.

@smiller171
Copy link
Contributor

This seems to actually work now. Not sure what changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants