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

fix: with-tw removed unused styles and added motion saftey #148

Merged
merged 1 commit into from
Jul 7, 2022

Conversation

JasonDocton
Copy link
Contributor

@JasonDocton JasonDocton commented Jul 7, 2022

Optimized tailwind styling for with-tw

  • I reviewed linter warnings + errors, resolved formatting, types and other issues related to my work
  • The PR title follows the convention we established conventional-commit
  • I performed a functional test on my final commit

The with-tw example, and perhaps other tw examples, contain multiple unused/unneeded styles and were not optimized for users who prefer reduced or no motion. Classes were also rearranged to maintain consistency across each div.

An examples of both unused/unneeded styling and class order:
grid grid-cols-1 grid-rows-3 lg:grid-rows-1 md:grid-rows-1 lg:grid-cols-3 md:grid-cols-3 gap-3 mt-3 pt-3 w-full lg:w-2/3 md:w-full
is now
grid gap-3 pt-3 mt-3 text-center md:grid-cols-3 lg:w-2/3
When we look at lg:grid-cols-3 md:grid-cols-3 we're saying that if @media (min-width: 1024px) or greater, we should have at least 3 columns in our grid. The added lg:grid-cols-3 is redundant. The original also has this class flow from lg, md, lg, md. For clarity and readability, those specific classes should begin with the smallest applicable screen and scale to largest since we're adding constraints as the screen scales.

Some minor css tweaks can be found with the removal of text-center and cursor-pointer across multiple components. Since all of our text is centered, this was applied to the common div. As the div's wrapping the grid blocks already have a pointer on hover, the additional pointer over the a tags isn't functional. Grid elements have also dropped the w-full and h-full classes, as the they naturally fill their container.


Screenshots

[Screenshots]

💯

Copy link
Member

@t3dotgg t3dotgg left a comment

Choose a reason for hiding this comment

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

Fantastic, ty for jumping on this and pushing best practice for Tailwind 🙏

Curious if the tailwind lint rules would have caught any of this? Maybe worth adding 🤔

@juliusmarminge
Copy link
Member

Is this an issue for the other versions of index.tsx that uses tailwind as well?

@JasonDocton
Copy link
Contributor Author

Fantastic, ty for jumping on this and pushing best practice for Tailwind 🙏

Curious if the tailwind lint rules would have caught any of this? Maybe worth adding 🤔

Of course!! Always happy to help! Especially with Tailwind stuff :D.

The Tailwind Prettier Plugin would have indeed caught these, but I'm not sure it's something I'd recommend adding. There are some known issues with it and PNPM that require some retooling by the user. Although I think class organization is important, and the format used follows MDN standards for css organizing, forcing that standard sounds like a high-level decision. Personally, I use Headwind to handle all of this.

@JasonDocton
Copy link
Contributor Author

Is this an issue for the other versions of index.tsx that uses tailwind as well?

Hey Julius!! Yup! Looks to be the case. Happy to edit those this weekend if someone doesn't get to them first :D.

Separately, I found some fixes for the Yarn 3 on M1 macs that was erroring the CLI. Not sure who the best person is to review that stuff, but happy to link what worked. It's super out of my scope, so I have no idea how it would impact other aspects of the repo- just that it worked for me on my M1.

@juliusmarminge
Copy link
Member

Hey Julius!! Yup! Looks to be the case. Happy to edit those this weekend if someone doesn't get to them first :D.

Great! Should I merge this and let you open a new one for the others or just leave it open until you get to them? No rush really.

Separately, I found some fixes for the Yarn 3 on M1 macs that was erroring the CLI. Not sure who the best person is to review that stuff, but happy to link what worked. It's super out of my scope, so I have no idea how it would impact other aspects of the repo- just that it worked for me on my M1.

I guess maybe leave a comment on that issue and linking it in the Discord, seems to be a few people subscribing to that with some knowledge about that.

@JasonDocton
Copy link
Contributor Author

Hey Julius!! Yup! Looks to be the case. Happy to edit those this weekend if someone doesn't get to them first :D.

Great! Should I merge this and let you open a new one for the others or just leave it open until you get to them? No rush really.

Merge sounds good to me! Especially at the rate people are starting and using create-t3-app, the more people using the correct standards for CSS the better :D.

Separately, I found some fixes for the Yarn 3 on M1 macs that was erroring the CLI. Not sure who the best person is to review that stuff, but happy to link what worked. It's super out of my scope, so I have no idea how it would impact other aspects of the repo- just that it worked for me on my M1.

I guess maybe leave a comment on that issue and linking it in the Discord, seems to be a few people subscribing to that with some knowledge about that.

Oh awesome!! I'll check the Discord and share there. Thanks!!

@juliusmarminge juliusmarminge merged commit 598ed0e into t3-oss:main Jul 7, 2022
devvianto605 pushed a commit to devvianto605/create-devviantex-nextjs-app-deprecated that referenced this pull request Jun 9, 2024
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.

None yet

3 participants