fix: with-tw removed unused styles and added motion saftey #148
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Optimized tailwind styling for with-tw
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 addedlg: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
andcursor-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]
💯