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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swipe-card in layout-card does not update its size #147

Closed
4 tasks done
matt8707 opened this issue May 29, 2021 · 4 comments
Closed
4 tasks done

swipe-card in layout-card does not update its size #147

matt8707 opened this issue May 29, 2021 · 4 comments

Comments

@matt8707
Copy link

My Home Assistant version: 2021.5.5

Layout-card version (FROM BROWSER CONSOLE): 2.2.3

What I am doing:
Using swipe-card in custom:grid-layout.

What I expected to happen: The swipe card should update its size to fit the grid

What happened instead: The swipe card only updates its size if the window is resized, looks like this.swiper.update(); is called. The thing is, in regular lovelace it updates its size, but using custom:masonry-layout it does not so I'm unsure if it's related to swipe-card or layout-card.

related bramkragten/swipe-card#32

Minimal steps to reproduce:

views:
  - type: custom:grid-layout
    path: 0
    layout:
      grid-template-columns: 1fr 1fr
      grid-template-rows: 1fr
      grid-template-areas: |
        "one two"
    cards:
      - type: grid #grid needed as container?
        view_layout:
          grid-area: one
        columns: 1
        cards:
          - type: custom:swipe-card
            view_layout:
              grid-area: one
            cards:
              - type: picture
                image: 'https://demo.home-assistant.io/stub_config/t-shirt-promo.png'
              - type: entities
                entities:
                  - light.x
      - type: picture
        view_layout:
          grid-area: two
        image: 'https://demo.home-assistant.io/stub_config/t-shirt-promo.png'

Error messages from the browser console: None


By putting an X in the boxes ([X]) below, I indicate that I:

@jrbloemhof
Copy link

This is an issue with the library underpinning swipe-card (see bramkragten/swipe-card#32), not something that can be fixed by layout-card.

@matt8707
Copy link
Author

It’s not though. swipe-card updates its size in vanilla lovelace but not in layout-card. I bet the issue lies with swipe-card and not layout-card and I also understand that a custom card cannot support all other custom cards.

@jrbloemhof
Copy link

The reason I say it's not something that can be fixed by layout-card is because the library underpinning swipe-card is documented to only respond when the window resizes.

breakpointsBase: If set to window (by default) then breakpoint keys mean window width.

So there's nothing layout-card could reasonably do to adjust this behavior.

On the other hand, swipe-card lets you adjust Swiper parameters - setting "breakpointsBase" to "container" may fix your issue.

@matt8707
Copy link
Author

I've mostly fixed it by removing the margin from parent container but, you're right. I'm closing the issue for layout-card

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

No branches or pull requests

2 participants