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

Add unit to temperature tile number button group #17841

Merged
merged 5 commits into from
Nov 10, 2023

Conversation

spacegaier
Copy link
Member

Breaking change

Proposed change

The tile feature was missing the temperature unit.

I pulled out the value and unit formatting logic so we are not redundantly copying that around.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@github-actions github-actions bot added the Design Related to Home Assistant design gallery label Sep 7, 2023
@piitaya
Copy link
Member

piitaya commented Sep 20, 2023

Hello 👋
The target temperature tile feature has been designed to fit half screen, so adding the unit will cause overflow.

CleanShot 2023-09-20 at 14 18 30

We should only show unit if there isn't enough space. May be using https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_container_queries? I never tested it but browser support is not bad : https://caniuse.com/css-container-queries

@bramkragten
Copy link
Member

We should only show unit if there isn't enough space. May be using developer.mozilla.org/en-US/docs/Web/CSS/CSS_container_queries? I never tested it but browser support is not bad : caniuse.com/css-container-queries

That's pretty sweet, we should use that in other places too where we now use resize-observer

@piitaya
Copy link
Member

piitaya commented Nov 9, 2023

I used container queries to hide the unit if space is missing.

CleanShot 2023-11-09 at 15 35 54

CleanShot 2023-11-09 at 15 38 00

I also used blankBeforeUnit introduced by #18567


return html`
<div class="container">
<div
id="input"
class="value"
role="number-button"
role="spinbutton"
Copy link
Member

Choose a reason for hiding this comment

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

Role was wrong

@github-actions github-actions bot added the Dependencies Pull requests that update a dependency file label Nov 9, 2023
@piitaya piitaya mentioned this pull request Nov 10, 2023
9 tasks
@piitaya piitaya merged commit d3f6ebd into home-assistant:dev Nov 10, 2023
12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed Dependencies Pull requests that update a dependency file Design Related to Home Assistant design gallery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tile card temperature target feature > Missing units
3 participants