react-gradient-color-picker icon indicating copy to clipboard operation
react-gradient-color-picker copied to clipboard

React-jss with Next.js style issues

Open DMaxence opened this issue 1 year ago • 10 comments

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

DMaxence avatar Feb 07 '24 09:02 DMaxence

Same problem here but without use client

ewan-kerboas avatar Feb 11 '24 20:02 ewan-kerboas

Same here

7sne avatar Feb 11 '24 21:02 7sne

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.

hxf31891 avatar Feb 15 '24 23:02 hxf31891

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 ?

nicosh avatar Feb 16 '24 10:02 nicosh

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

hxf31891 avatar Feb 16 '24 12:02 hxf31891

@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'

nicosh avatar Feb 16 '24 13:02 nicosh

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

hxf31891 avatar Feb 16 '24 13:02 hxf31891

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

I have not tested the final build

nicosh avatar Feb 16 '24 14:02 nicosh

@nicosh thanks I will test it out

hxf31891 avatar Feb 16 '24 14:02 hxf31891

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 avatar Feb 16 '24 14:02 hxf31891

@nicosh this should be fixed as of 3.0.10

hxf31891 avatar Jul 19 '24 08:07 hxf31891