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

chore: optimize Tailwind CSS classes #549

Merged
merged 17 commits into from
Jul 29, 2024
Merged

chore: optimize Tailwind CSS classes #549

merged 17 commits into from
Jul 29, 2024

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Jul 28, 2024

Summary

Fix and cleanup css, in anticipation of adding eslint rules for scss.

Those are just regular and simple fixes, without any controversial rules

  • Remove invalid button-outline classes, ported from snapshot v1
  • Remove invalid text-color
  • Use shorthand classes when possible (w-[] z-[] to size-[])
  • Use tailwindcss own size class instead of arbitrary px values (s-[4px] to s-1)
  • Arbitrary classes should not start by -, use negative value instead (-mb-[5px] will become mb-[-5px])
  • Replace invalid class by their nearest valid equivalent (flex-grow -> grow, z-5 -> z-10, etc ...)
  • Remove conflicting class (flex and box simultaneous usage)

Todo in a later pr will be more heavy changes, like css classes ordering

@wa0x6e wa0x6e marked this pull request as ready for review July 29, 2024 02:21
@wa0x6e wa0x6e requested a review from Sekhmet July 29, 2024 02:22
@Sekhmet Sekhmet requested a review from ChaituVR July 29, 2024 09:39
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

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

nACK

Let's discuss each change first and submit smaller PRs for different changes.

As of now I think those points can have been submitted already:

  • Remove conflicting class (flex and box simultaneous usage)
  • Use shorthand classes when possible (w-[] z-[] to size-[])
  • Replace invalid text-color class by text-skin-text
  • Remove invalid button-outline classes, ported from snapshot v1
  • Arbitrary classes should not start by -, use negative value instead (-mb-[5px] will become mb-[-5px])

Ideally those should be separated into each own PR so we can easily review it and test it doesn't break anything.

The rest should be discussed first.

apps/ui/src/App.vue Outdated Show resolved Hide resolved
apps/ui/src/components/App/Sidebar.vue Outdated Show resolved Hide resolved
@wa0x6e
Copy link
Contributor Author

wa0x6e commented Jul 29, 2024

nACK

Let's discuss each change first and submit smaller PRs for different changes.

As of now I think those points can have been submitted already:

  • Remove conflicting class (flex and box simultaneous usage)
  • Use shorthand classes when possible (w-[] z-[] to size-[])
  • Replace invalid text-color class by text-skin-text
  • Remove invalid button-outline classes, ported from snapshot v1
  • Arbitrary classes should not start by -, use negative value instead (-mb-[5px] will become mb-[-5px])

Ideally those should be separated into each own PR so we can easily review it and test it doesn't break anything.

The rest should be discussed first.

Updated to revert all changes requiring any discussions.

This PR was meant to be a no-brainer changes, and should include only obvious fixes which does not require any testing

@wa0x6e wa0x6e requested a review from Sekhmet July 29, 2024 11:07
@Sekhmet
Copy link
Member

Sekhmet commented Jul 29, 2024

For text-color -> text-skin-text changes - as text-color wasn't doing anything before shouldn't we just remove this property entirely? Now we either add property that doesn't change anything or we change colour making it break old behaviour.
In this case it looks like we just add property that doesn't actually do anything.

@wa0x6e
Copy link
Contributor Author

wa0x6e commented Jul 29, 2024

For text-color -> text-skin-text changes - as text-color wasn't doing anything before shouldn't we just remove this property entirely? Now we either add property that doesn't change anything or we change colour making it break old behaviour. In this case it looks like we just add property that doesn't actually do anything.

removed

apps/ui/src/components/ProposalResults.vue Outdated Show resolved Hide resolved
@@ -304,7 +304,7 @@ input:placeholder-shown {
.s-label:has(+ textarea),
.s-base:has(textarea:only-child) {
&::before {
@apply block bg-gradient-to-b from-skin-border to-transparent h-2 w-full absolute top-[20px] left-0;
@apply block bg-gradient-to-b from-skin-border to-transparent h-[8px] w-full absolute top-3.5 left-0;
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why h-2 was changed to h-[8px].

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For consistency, everything that is not spacing related ((m|p|space|gap)-[0-9]) is using arbitrary pixels value.

we're already using h-[32px] for avatar, etc ...

Or should we keep using both h-2 and h-[8px] ?

Copy link
Member

Choose a reason for hiding this comment

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

I see, let's keep it like this then.

@Sekhmet Sekhmet changed the title fix: fix CSS chore: optimize Tailwind CSS classes Jul 29, 2024
Copy link
Member

@Sekhmet Sekhmet left a comment

Choose a reason for hiding this comment

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

tACK

@Sekhmet
Copy link
Member

Sekhmet commented Jul 29, 2024

@wa0x6e merge conflict needs to be resolved.

@Sekhmet Sekhmet merged commit c787f24 into master Jul 29, 2024
3 checks passed
@Sekhmet Sekhmet deleted the fix-css branch July 29, 2024 13:35
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.

2 participants