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

Replace style prop with utility css classes #16826

Closed
thmsobrmlr opened this issue Jul 29, 2023 · 10 comments · Fixed by #25035
Closed

Replace style prop with utility css classes #16826

thmsobrmlr opened this issue Jul 29, 2023 · 10 comments · Fixed by #25035
Labels
good first issue Good for newcomers

Comments

@thmsobrmlr
Copy link
Contributor

We're cleaning up how we write css. Previously we would often use the style prop e.g. <div style={{position: 'absolute', top: 8}} '/> to style components. We're now replacing this with utility classes that are very similar to the tailwind classes.

More Context

The locations that need updating can be found by running the following command:

 pnpm eslint --rule "{react/forbid-dom-props: warn}" 

Please note that not all styles can be replaced with utility classes. When dynamic values are passed in, we keep the style prop (or at least keep it for the dynamic values) and add the eslint directive // eslint-disable-next-line react/forbid-dom-props to mark this occurance as ok.

Documentation

Contributors

When you want to work on this PR, don't try to do it all at once. Rather pick out a couple (1-10) files and replace the styles there. It often makes sense to pick a specific product area or page so that changes can easily be reviewed together.

@thmsobrmlr thmsobrmlr added bug Something isn't working right good first issue Good for newcomers labels Jul 29, 2023
@thmsobrmlr thmsobrmlr changed the title chore(styles): replace style prop with utility css classes Replace style prop with utility css classes Jul 29, 2023
@thmsobrmlr thmsobrmlr removed the bug Something isn't working right label Jul 29, 2023
@thmsobrmlr thmsobrmlr mentioned this issue Jul 29, 2023
20 tasks
@Udit-takkar
Copy link

@thmsobrmlr can i work on this issue?

@ebrahim95
Copy link

Can multiple people work on this issue? If so then I would like to do it too.

Thank You

@thmsobrmlr
Copy link
Contributor Author

You're both welcome to work on this and we don't typically assign issues. I'd like to avoid a situation where you both work on the same things though. Maybe @Udit-takkar can start from the top of eslint issues and @ebrahim95 from the bottom? Or align with each other and post a short notice of an area you work on.

@BalanaguYashwanth
Copy link

BalanaguYashwanth commented Dec 3, 2023

Is this Issue is open to contribute?

@mariusandra
Copy link
Collaborator

This is an long running project. Feel free to contribute if you'd like!

@BalanaguYashwanth
Copy link

ok

@Dejvino
Copy link

Dejvino commented Jun 9, 2024

Looks like this is no longer reproducible and can be closed since PR #19134 started enforcing the eslint rule.

@thmsobrmlr
Copy link
Contributor Author

@Dejvino

Looks like this is no longer reproducible and can be closed since PR #19134 started enforcing the eslint rule.

There are still quite a bunch of these in the codebase, they just have been ignored from the linter with eslint-disable-next-line react/forbid-dom-props directives.

@anirudh24seven
Copy link
Contributor

@thmsobrmlr I believe that the purpose of issues under the "good first issue" label in open source projects is for developers to get familiar with the code base, PR process, etc.

In light of the above, can I continue to open more PRs myself for this task or shall I leave it as an opportunity for others to learn from this task while I pick up other tasks?

I believe that frontend tasks like these provide an opportunity to quickly learn about the product from an end-user POV as well.

@anirudh24seven
Copy link
Contributor

@thmsobrmlr Please have a look at the above PR and let me know your thoughts. Meanwhile, I'll investigate if I can run the snapshot tests (even though I am following the instructions at #23699).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants