almond-bongbong / react-simple-toasts

🍞 Instant, lightweight toast notifications for React. No providers or containers needed.
https://almond-bongbong.github.io/react-simple-toasts/
37 stars 9 forks source link

Can't override css module styles #97

Open hemengke1997 opened 2 months ago

hemengke1997 commented 2 months ago

Grate lib! Respect!

classnames like toast-message which could not be override because they are css modules.

For better scalability, there are two ways to do this

  1. refactor css modules to global css and devleopers import the css file manualy
  2. add some classnames options then pass to toast-message component.

I think method one is better.

almond-bongbong commented 2 months ago

Thank you for your valuable input and the PR. I appreciate your effort to improve the library's flexibility. Your suggestion to refactor CSS modules to global CSS does have merits, as you pointed out. It would simplify the overall code structure and make overriding styles more straightforward. However, we should also consider potential drawbacks:

Global CSS may lead to naming conflicts and unintended style overrides across the application. We might lose the benefits of CSS modules, such as local scoping and automatic class name generation.

That being said, I agree that the benefits could outweigh the drawbacks in this case, especially for improving customization options for developers.

Before proceeding, I'd like to review the specific changes in your PR to ensure they align with our project's goals and don't introduce any unintended side effects.

Once again, thank you for your contribution. We'll carefully evaluate the proposed changes and get back to you soon with our decision or any additional questions we may have.

hemengke1997 commented 2 months ago

In fact, many popular react libraries are based on bem or cssinjs such as react-toastify. Personally, I don't think there is any need to worry about css conflicts. Both BEM and developers can avoid this problem.

However, it is up to you to decide whether to use the css module or global css. If there are other ways to achieve custom styles, you can also consider them.

In addition, I think it is necessary to solve the problem of closing timeout with fixed 300ms, because timeout is uncertain, and using onTransitionEnd is a relatively better way.

almond-bongbong commented 2 months ago

I agree with your opinion! I will review the code and implement the changes as soon as possible. Thank you!

hemengke1997 commented 2 months ago

Thank you for your reply and support.

If there is anything I need to intervene in, please feel free to contact me.

Thank you very much for your contribution to the open source community. This is a great library.