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

Upgrade bitstyles to 5.0.1 #125

Merged
merged 20 commits into from
Jul 9, 2024

Conversation

angelikatyborska
Copy link
Contributor

@angelikatyborska angelikatyborska commented Apr 15, 2024

Resolves #122

Note that the sidebar example in 4.3.0 will look weird because it contains a lot of example content that's written with attributes supported in 5.0.0 only.

Also note that the class a-button is now display: flex instead of display: inline-flex and now <a>s with that class look different than <button>s with that class due to different default widths of the two elements. This discrepancy would need to be fixed on a project level where bitstyles-phoenix is used, by something like a { width: fit-content } or so. Or just be using those elements inside appropriate flex/grid containers.

List of changes:

  • Button rewrite (see linked issue)
  • u-gap-m is u-gap-l, looks identical
  • a-list-reset is u-list-none
  • a-badge--gray is a-badge--text
  • Brand2 color changed from yellow to blue, nothing to do about that
  • Color palette changed a lot, causing u-fg- and u-bg- classes to be different. Darren helped me choose adequate replacements.
  • Size naming changed to use a number instead of repeating a letter, e.g. xxxs is 3xs.

@angelikatyborska
Copy link
Contributor Author

Waiting for bitstyles v5.0.0 to be republished as v5.0.1 with the correct CSS build.

@angelikatyborska angelikatyborska changed the title Upgrade bitstyles to 5.0.0 Upgrade bitstyles to 5.0.1 Jul 1, 2024
@angelikatyborska angelikatyborska marked this pull request as ready for review July 1, 2024 14:15
@angelikatyborska
Copy link
Contributor Author

angelikatyborska commented Jul 2, 2024

Note to self: fix heading with list, the list should not look like a list
Note to self: fix sidebar border color
Note to self: fix tabs, the list should not look like a list

Edit: done

case class do
"u-list-none" -> "a-list-reset"
"a-badge--text" -> "a-badge--gray"
"u-gap-l" -> "u-gap-m"
Copy link
Member

@andreasknoepfle andreasknoepfle Jul 8, 2024

Choose a reason for hiding this comment

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

🤔 this will change the behaviour quite a lot, right? We have numerous places in the code in dima e.g. that use u-gap-l already. They will all be using u-gap-m afterwards if they pass through this. But there is also only one bitstyles helper using u-gap-m. Mabye we can instead simply list this as a change for ui_dl_item, since one can always pass in an overriding u-gap-l into the classes and not add this migration here.
After all size can also be maintained by setting the gap size in sass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I understand...

We have numerous places in the code in dima e.g. that use u-gap-l already. They will all be using u-gap-m afterwards if they pass through this.

Isn't this exactly what we want? The class u-gap-m is 4.3.0 has the same styles as u-gap-l in 5.0.0. The name of the class changed, but the exactly rem value used for the gap remained the same.

Copy link
Member

Choose a reason for hiding this comment

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

But then are the values for u-gap-m and u-gap-l then same value by default now?
What I am saying is also that we do not make an assumption on the "migratedness" of foreign code that uses the helpers. With this setting you basically can't use u-gap-l anymore with bistyles 4.3.0 even if you want to have that value if you have classes going through this helper.

Copy link
Member

Choose a reason for hiding this comment

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

Also keep in mind the values are always just values set by the sass variables, so one can always go back to the old values if they want to not migrate things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But then are the values for u-gap-m and u-gap-l then same value by default now?

The class u-gap-m does not exist in the default configuration of bitstyles in 5.0.0, see:

https://github.com/bitcrowd/bitstyles/blob/v5.0.1/scss/bitstyles/utilities/gap/_settings.scss#L4-L7

What I am saying is also that we do not make an assumption on the "migratedness" of foreign code that uses the helpers. With this setting you basically can't use u-gap-l anymore with bistyles 4.3.0 even if you want to have that value if you have classes going through this helper.

I think I understand. It's fine to define class mappings in this module if the new class only exists in the new version, and the old class only exists in the old version. But here we have a new class that exists in both new and old version, but with a different meaning in the old version (u-gap-l from 4.3.0 would be equivalent to u-gap-xl in 5.0.0)

Copy link
Contributor Author

Choose a reason for hiding this comment

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


class =
Enum.reduce(sizes_renaming, class, fn {new_size, old_size}, acc ->
String.replace(acc, "-#{new_size}", "-#{old_size}")
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we at least make sure here, that the class starts with u- and is a bitstyles class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

|> Keyword.put_new(:variant, "menu")

extra =
if Bitstyles.version() >= "5.0.0" do
Copy link
Member

Choose a reason for hiding this comment

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

We really have to start refactoring version comparisons to not use strings at some point 🙈
But good for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes 😇 I'll try to squeeze in that work in my schedule after 5.0.0 and 6.0.0 upgrades are merged

Copy link
Member

@andreasknoepfle andreasknoepfle left a comment

Choose a reason for hiding this comment

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

Awesome work. 💚 I have small annotations on the version compatibility.

Copy link
Member

@andreasknoepfle andreasknoepfle left a comment

Choose a reason for hiding this comment

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

Fine from my perspective. Can you also prepare a CHANGELOG entry, listing the u-gap-m to u-gap-l change on the affected components.

@angelikatyborska angelikatyborska merged commit e9d7e9b into main Jul 9, 2024
2 checks passed
@angelikatyborska angelikatyborska deleted the feature/122-upgrade-bitstyles-to-5-0-0 branch July 9, 2024 10:08
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

Successfully merging this pull request may close these issues.

Upgrade bitstyles to 5.0.0
2 participants