question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v2.0 breaking changes - "min_columns" option missing

See original GitHub issue

How to transform code to have cards look the same like with v16 (last release before v2.0.0)?

What I had in a view with panel mode enabled:

type: 'custom:mod-card'
style: |
  ha-card {
    padding: 7px;
    background: none;
  }
card:
  type: 'custom:layout-card'
  layout: horizontal
  min_columns: 2
  max_width: 100%
  cards:
    - type: 'custom:mod-card'
      style: |
        ha-card {
          height: 220px
        }
      card:
        type: button
        tap_action:
          action: navigate
          navigation_path: betriebsstatus
        name: Betriebsstatus
        icon: 'mdi:checkbox-marked-circle'
        hold_action:
          action: none
    - type: 'custom:mod-card'
      ...
      ...

Relevant part: with v2.0 instead of

  type: 'custom:layout-card'
  layout: horizontal
  min_columns: 2
  max_width: 100%
  cards:

I tried

  type: 'custom:layout-card'
  layout_type: horizontal
  layout_options:
    column: 2
    max_width: 100%
  cards:

but the result is not the same: now I have only ONE column on the mobile/smartphone view instead of two next to each other.

“Breaking change” is good to know, but where´s guidance on how to fix things so everything can look the same as before the update? I´m a bit lost…

It seems like min_columns does not exist anymore. How to achieve what that did with v2.0 now?

Look desktop with v16 release (GOOD): grafik

Look desktop after updating to v2.0.0 release without changing anything (BAD): grafik

–> When making above code changes, desktop looks GOOD.

I can adjust the view so on the desktop it looks like before the update. BUT then the mobile view will break:

mobile view with v16 (GOOD): grafik

mobile view with v2.0.0 after applying some code changes (BAD): grafik

–> When making above changes, mobile is broken (missing 2 columns setup).

I always need to balance the UI to have it look good on the desktop and the mobile view at the same time. With v16 this was possible. With v2.0.0 I see no way to achieve the same.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bcuttercommented, Apr 11, 2021

That is awesome! Now I understand the mediaquery. Depending on screen size you can set additional, individual layout options. Great. I updated all my affected views. Not only they look the same like (on some screens even better than) with v16, there´s also much more flexibility to adjust to different screen sizes, I don´t need to use panel mode anymore and there´s a bit of code reduction (less complexity) too.

Note: grid-template-columns: 'repeat(auto-fill, minmax(300px, 1fr))' did not work for me because it does not create the needed second column on the mobile view. I´ll stay with the less compact but easier to understand variant.

Lucky. Thanks again! Closed 😃

1reaction
Jpsycommented, Apr 11, 2021

Glad that solution helps. grid-layout is definitely the most versatile option as it leverages the full power of CSS grid styles.

You can combine as many mediaqueries as you need. For your 28" you can try:

layout:
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr
  grid-template-rows: auto
  mediaquery:
    '(max-width: 600px)':
      grid-template-columns: 1fr 1fr
    '(max-width: 1200px)':
      grid-template-columns: 1fr 1fr 1fr 1fr

A shorthand for 1fr 1fr 1fr 1fr 1fr 1fr would be repeat(6, 1fr)

But what comes closest to your original idea would probably be this very compact solution without any mediaqueries:

layout:
  grid-template-columns: 'repeat(auto-fill, minmax(300px, 1fr))'
Read more comments on GitHub >

github_iconTop Results From Across the Web

Rule Proposal: array-element-newline · Issue #6075 - GitHub
minColumn : (default is 0 ) - requires line breaks if the max column of properties (if line breaks between properties were removed)...
Read more >
Options and settings — pandas 1.5.2 documentation
pandas has an options API configure and customize global behavior related to DataFrame display, data behavior and more. Options have a full “dotted-style”,...
Read more >
util-linux v2.38 - LWN.net
It's necessary to use a configure option --enable-poman to enable, ... add missing files from tools/ directory [Karel Zak] - add missing ......
Read more >
ormar - Python Package Health Analysis | Snyk
ormar also follows the release numeration that breaking changes bump the major number, while other changes and fixes bump minor number, so with...
Read more >
D28462 clang-format: Add new style option ... - LLVM
when the rest of clang (& C++ for that matter) is changing so rapidly underneath? To learn a code base in order to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found