hxf31891 / react-gradient-color-picker

An easy to use color/gradient picker for React.js
MIT License
144 stars 45 forks source link

React-jss with Next.js style issues #84

Closed DMaxence closed 2 months ago

DMaxence commented 7 months ago

I'm using Next.js 14 and I think because of react-jss the styles are not loaded even if I use it in client mode with "use client".

I have in my console this warning :

Capture d’écran 2024-02-07 à 10 53 00

The classes seems generated but there's no style in it.

Capture d’écran 2024-02-07 à 10 54 21

I created a sandbox with the bug so you can see https://codesandbox.io/p/devbox/empty-snowflake-td4xnv

ewan-kerboas commented 7 months ago

Same problem here but without use client

7sne commented 7 months ago

Same here

hxf31891 commented 7 months ago

Apologies all, CSS & Next has been a persistent issue with this project. I thought JSS would work but apparently not. Regardless will try and get this fixed ASAP.

nicosh commented 7 months ago

Apologies all, CSS & Next has been a persistent issue with this project. I thought JSS would work but apparently not. Regardless will try and get this fixed ASAP.

My i ask you why you choose to use JSS instead of CSS Modules ?

hxf31891 commented 7 months ago

@nicosh Next refuses to import style sheets used within npm packages

nicosh commented 7 months ago

@hxf31891 What you mean? You can import external stylesheets without any problem in next.js (as many libraries does). However my question was about CSS modules that are supported natively by react and next without the need of external packages. I've forked the repo and everything work fine by just changing one line of code :

  const useStyles = createUseStyles(styles)
  const classes = useStyles()

with

import styles from '../main.module.css'

hxf31891 commented 7 months ago

@nicosh Could you create a PR with your changes please?

nicosh commented 7 months ago

@hxf31891 https://github.com/hxf31891/react-gradient-color-picker/pull/88

I have not tested the final build

hxf31891 commented 7 months ago

@nicosh thanks I will test it out

hxf31891 commented 7 months ago

Alright I believe this to be fixed in the latest version v3.0.6

Big thanks @nicosh, much appreciated.

I will leave this open for a bit please let me know if the issue persists or others arrive.

One thing to note is that at least for now I removed disableDarkMode which was over complicating things. Will try and bring back in a later release if anybody is using it.

hxf31891 commented 2 months ago

@nicosh this should be fixed as of 3.0.10