Pierre-Adrien / laravel-cookie-consent

This package provides a fully configurable cookie-consent popup for a Laravel project.
MIT License
7 stars 3 forks source link

Change the styling #1

Open taliesinpenbardd opened 2 years ago

taliesinpenbardd commented 2 years ago

Hey, congrats and thanks for that package that works with the French law.

However, the CSS file makes it hard to change the styling of the elements. Would you mind if I'd propose a PR to adjust it for TailwindCSS ? That would allow everyone (using Tailwind, that is) to change the styling according to one's desires. Regards

Pierre-Adrien commented 2 years ago

Hey, thank you !

My main goal with that package was to made it fully customizable and usable without any specific library. The package contains the scss files and it's possible to generate a new css file from them after the needed updates.

In a second time, and I'm glad you created that issue, I wanted to make the package usable with some css framework. I had "bootstrap" in mind but I'm open to other ones like "tailwind". The only thing I want to maintain is the fact that the package is fully configurable. The use of a css framework must be in a new configuration property in order to don't force the use of it. Here's what I thought :

I'm ok with your proposition for a PR for Tailwind. I gave you my ideas but if you have other propositions instead I'll be happy to discuss it with you. (I'm in holidays and my answers may not be very fast).

taliesinpenbardd commented 2 years ago

Enjoy your holidays :)

What I had in mind was to allow each and everyone to do whatever one wants with it.

I tried to remove the app.css in the cookie-consent/popup-container.blade.php file and add Tailwind's styling, but it seems that it breaks some javascript actions (showing and hiding parts of the template).

In my mind, decoupling JS and CSS would allow the JS to work whatever the CSS framework is chosen, or to use the app.css file (just link to it in the mentioned template), or remove the CSS link and add your Bootstrap/Tailwind classes to style it as you want.

Perhaps the full support for different styles could be made later.

Anyway, my hands are a bit full right now, but I plan on using your package in the future, I'll do my PR and let you see wether you want to accept it or not. :)

Edit : et l'usage de l'anglais n'est que par respect pour la communauté des dévs Laravel :)

Pierre-Adrien commented 2 years ago

I totally agree with decoupling JS and CSS.

Actually I use a custom class "cookie-consent-popup-hider" to hide and display items. By removing the app.css, that doesn't work anymore but as you said changing the CSS should not break the javascript. The responsible functions are "pDisplay" and "pHide" and should only use javascript.

Ok for your PR, I'll continue to work on it after to make the full support for different styles.

PS : Ça me permet aussi de pratiquer mon anglais, j'ai plus l'habitude de le lire ou de l'écouter que de l'écrire ou encore moins de le parler. J'espère que ça ne se voit pas trop 😂