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

Update card to comply with new "design grid system" #145

Open
ThomDietrich opened this issue Jul 29, 2024 · 5 comments
Open

Update card to comply with new "design grid system" #145

ThomDietrich opened this issue Jul 29, 2024 · 5 comments

Comments

@ThomDietrich
Copy link

ThomDietrich commented Jul 29, 2024

https://www.home-assistant.io/blog/2024/07/26/dashboard-chapter-2/#design-framework-what-will-our-card-designs-be-based-upon

This ticket is open for grabs. PRs welcome!

@PhilippeP62
Copy link

I have no test environment setup but should just add this to HorizonCard.ts be enough?

public getLayoutOptions() {
    let grid_rows = 4 // Smallest possible card (only graph) is 4 rows

    const fieldConfig = this.expandedFieldConfig()

    // Each element of card (title, header, content, footer) adds 1 row
    if (this.config.title && this.config.title.length > 0) {
      grid_rows += 1
    }

    if (fieldConfig.sunrise || fieldConfig.sunset) {
      grid_rows += 1
    }

    if (fieldConfig.dawn || fieldConfig.noon || fieldConfig.dusk) {
      grid_rows += 1
    }

    if (fieldConfig.sun_azimuth || fieldConfig.moon_azimuth || fieldConfig.sun_elevation || fieldConfig.moon_elevation) {
      grid_rows += 1
    }

    if (fieldConfig.moonrise || fieldConfig.moon_phase || fieldConfig.moonset) {
      grid_rows += 1
    }

  return {
    grid_rows,
    grid_columns: 4,
    grid_min_columns: 4,
    grid_min_rows: 4,
  };
}

@ThomDietrich
Copy link
Author

Hey @PhilippeP62,
thanks, this is much appreciated!
If it's not too much to ask it would be amazing if you could set the environment up and test. If it works let's move into a PR.

Bonus points for documenting the dev environment in the README :)

@PhilippeP62
Copy link

Never worked with github , looked at the info , seems not the easiest thing but will try ....

@ThomDietrich
Copy link
Author

Sounds like the perfect opportunity to learn something new! ✨
No seriously, we honestly appreciate your efforts!

@PhilippeP62
Copy link

Well sorry but no , I don't have the slightest idea of what I'm doing so I'll pass

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