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

Refactor: Handle manual condition checks using clsx #66

Open
sboy99 opened this issue Feb 3, 2023 · 7 comments
Open

Refactor: Handle manual condition checks using clsx #66

sboy99 opened this issue Feb 3, 2023 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@sboy99
Copy link
Member

sboy99 commented Feb 3, 2023

What would you like to share or ask?

As clsx library has the same and better potentials to handle class names of tailwindcss so using clsx would be better than manual conditioning.

Additional information

Try to replace each and every component that uses className attribute as a condition.

@sboy99 sboy99 added the enhancement New feature or request label Feb 3, 2023
@AniketNS
Copy link
Contributor

Hello @sboy99, I'd love to work on this issue. Please assign this to me.

@priyankarpal
Copy link
Collaborator

priyankarpal commented Mar 23, 2023

Hello @sboy99, I'd love to work on this issue. Please assign this to me.

Work on this issue & also share screenshots.

@AniketNS
Copy link
Contributor

Hey @priyankarpal, will you please elaborate on the issue?

@priyankarpal
Copy link
Collaborator

Hey @priyankarpal, will you please elaborate on the issue?

clsx is a utility library that helps you manage multiple class names more efficiently. With clsx, you can easily conditionally add, remove, or toggle class names based on different states or props.

https://www.npmjs.com/package/clsx

@sboy99
Copy link
Member Author

sboy99 commented Mar 30, 2023

This is a technical issue. As most of the layouts and components in this project accept className attribute so what we did earlier was render conditionally. But this is nicely handled by clsx what it does is replace the class that might have a conflict. For example you are using w-4 as a utility class in the component and when you are calling the component from another component you passed the className w-12 so clsx will automatically detect that and will apply w-12 for this case else it will set the default one.

The task is to find out the layouts and components and change to clsx.

Why it is needed??
On that time We wasn't aware of the functionality of clsx but now. So small refactoring 😃

@AniketNS
Copy link
Contributor

Thank you so much @sboy99, now I get the issue. I'm going to start working on it from now.

@sboy99
Copy link
Member Author

sboy99 commented Mar 30, 2023

@AniketNS Yup all the best 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants