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

Move attribute pre styles to ha-attribute-value component #18649

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/ha-attribute-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ class HaAttributeValue extends LitElement {

static styles = css`
pre {
font-family: inherit;
font-size: inherit;
margin: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious - are there any considerations for this? I usually use units with zero values, but I am not a css expert .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No issues in this case. Lengths in CSS can be zero with no units. It's a habit I've had for like 15 years, I read somewhere that it was a "best practice" back then and it stuck. It's potentially a problem with using calc() and some other "newer" CSS features, but it's more of a personal preference than anything. I don't feel super strongly about it, especially on an open source project that I am just a contributor to. I'm happy to add the units back if that's the general preference for HA.

Copy link
Member

Choose a reason for hiding this comment

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

I use zero without units too, so 🤷‍♂️

white-space: pre-wrap;
overflow-wrap: break-word;
white-space: pre-line;
}
`;
}
Expand Down
7 changes: 0 additions & 7 deletions src/components/ha-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,6 @@ class HaAttributes extends LitElement {
text-align: center;
margin-top: 16px;
}
pre {
font-family: inherit;
font-size: inherit;
margin: 0px;
overflow-wrap: break-word;
white-space: pre-line;
}
hr {
border-color: var(--divider-color);
border-bottom: none;
Expand Down
Loading