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

[Darkside] List CSS update #3354

Merged
merged 7 commits into from
Nov 19, 2024
Merged

[Darkside] List CSS update #3354

merged 7 commits into from
Nov 19, 2024

Conversation

KenAJoh
Copy link
Collaborator

@KenAJoh KenAJoh commented Nov 12, 2024

No description provided.

@KenAJoh KenAJoh self-assigned this Nov 12, 2024
@KenAJoh KenAJoh requested review from a team as code owners November 12, 2024 12:24
Copy link

changeset-bot bot commented Nov 12, 2024

⚠️ No Changeset found

Latest commit: 594f570

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Nov 12, 2024

Storybook demo / Chromatic

📝 Endringer til review: 1

288097fc0 | 91 komponenter | 135 stories

@JulianNymark
Copy link
Contributor

^ consider the latest commit here a suggestion (it was just easier to commit than to do a diff in the github editor / comment system when I already had the code changes on disk 😅 )

@HalvorHaugan
Copy link
Contributor

HalvorHaugan commented Nov 12, 2024

^ consider the latest commit here a suggestion (it was just easier to commit than to do a diff in the github editor / comment system when I already had the code changes on disk 😅 )

Before this change, the selectors were "grouped" logically. All selectors targeting navds-list__item was next to each other, and those having to do with the marker was next to each other. (I should have had headings though.) Do we think that the benefits of nesting outweighs the benefits of logical grouping? (Not meant as a leading question.)

@JulianNymark
Copy link
Contributor

Do we think that the benefits of nesting outweighs the benefits of logical grouping? (Not meant as a leading question.)

Good question 🤔. I can only argue for it being nice to somewhat locate the same hierarchy structure in CSS as in the DOM. But then you can't really group them per leaf-node (since the same leaf-node might appear at different parts of the tree).

There will also never be "one CSS tree to rule all styling" for any component either, though that would be cool in a simplicity sense 😅. But it's just not realistic to repeat yourself several times throughout the CSS tree just to ensure it stays "within" that tree. Targeting a BEM class is just too nice when you know you want to style it across all its locations in the DOM.

I'm not sure if the grouping by BEM target / leaf-node is a perfect strategy either, sometimes you get some "what goes where?" issues regardless? I'm thinking about stuff with a A:has(.B)(does this belong grouped with A, or B)? 🤔 (side note, we don't use that many has selectors, so might be a dumb example... it's what came to mind though)

@JulianNymark
Copy link
Contributor

^ To answer my own thoughts, I do think the A:has(.B) should be grouped with A, since it eventually targets that element (style gets applied to A), even though it's contingent on B. 🤔

@JulianNymark
Copy link
Contributor

I think the "ultimate colocating" of styling with what should get the styling is some sort of CSS-in-js 🤔 (stylex when!?). But we also want to generate those per component plain css files as well as a global stylesheet... I would have to look more into something like https://stylexjs.com/docs/learn/ to see if its something we could use 👀, I remember it was still pretty fresh last time I heard about it.

@JulianNymark
Copy link
Contributor

JulianNymark commented Nov 12, 2024

One more stream of consciousness rant here (thinking lead to more thinking). I'm not sure if us now grouping as much as possible by CSS nesting is completely incompatible with BEM target grouping, as long as the remaining CSS (that which doesn't fit inside a bigger tree) that is still grouped by BEM target? at least that makes sense to keep doing.

And I think that if you Ctrl+F for the BEM leaf-node you will still find all the locations without issue (you just can't search for multiple nodes anymore, do search: .my__button--special, do not search: parent > .my__button--special) 🤔.

JulianNymark
JulianNymark previously approved these changes Nov 14, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider not defining any color on the markers (3 instances). That way they will inherit the color the same way as the text does.

@KenAJoh KenAJoh merged commit 2c8dd2b into main Nov 19, 2024
4 checks passed
@KenAJoh KenAJoh deleted the darkside-list-css branch November 19, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants