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

DataTable: rowClassName don't take prevalence over passthrough tailwind #5983

Closed
Et7f3 opened this issue Feb 15, 2024 · 5 comments · Fixed by #5995 or #5996
Closed

DataTable: rowClassName don't take prevalence over passthrough tailwind #5983

Et7f3 opened this issue Feb 15, 2024 · 5 comments · Fixed by #5995 or #5996
Assignees
Labels
Component: Tailwind Tailwind specific issue
Milestone

Comments

@Et7f3
Copy link
Contributor

Et7f3 commented Feb 15, 2024

Describe the bug

The rowClassName attributes works and add the class bg-primary to row but the pt define some class bg-white that are applied after our customization.
We now have bg-primary bg-white

The step 4 of https://primereact.org/tailwind/#unstyledmode doesn't help (my twMerge is never called)

Reproducer

https://stackblitz.com/edit/d8kwfr?file=src%2Fmain.jsx,src%2FApp.jsx

PrimeReact version

10.5.1

React version

18.x

Language

ALL

Build / Runtime

Vite

Browser(s)

ALL

Steps to reproduce the behavior

  1. I took the exemple in https://primereact.org/datatable/#conditional_style
  2. in main.jsx
+import Tailwind from 'primereact/passthrough/tailwind';
-    <PrimeReactProvider>
+    <PrimeReactProvider value={{ pt: Tailwind }}>

Expected behavior

Class added with local customization should be visible instead of global classes.
My twMerge is used to resolve a conflict
I don't have to rewrite bodyrow to hide this bug. (this is my actual workaround)

@Et7f3 Et7f3 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 15, 2024
@melloware
Copy link
Member

Its because of this line...

className: classNames(rowClassName, cx('bodyRow', { rowProps: props })),

twMerge is not invloved here becaue that only mergeds all Pass Through props. This is calling cx('bodyRow', { rowProps: props }) and then appending rowClassName onto it.

@melloware
Copy link
Member

melloware commented Feb 15, 2024

Can you try your tw-merge with this...

https://stackblitz.com/edit/d8kwfr-srwond?file=src%2Fmain.jsx,src%2FApp.jsx

Basically I am using pt instead of rowClassname

pt={{
        bodyRow: ({ context }) => ({
          className: classNames('mt-2', {
            'bg-primary': products[context.index].category === 'Fitness',
          }),
        }),
      }}

@melloware melloware added Status: In Progress Core Team is working on the issue or pull request and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Feb 15, 2024
@melloware
Copy link
Member

@Et7f3 were you able to try this?

@Et7f3
Copy link
Contributor Author

Et7f3 commented Feb 16, 2024

Yes It suits my needs. I am writing a PR so rowClassName can be merged.

@melloware
Copy link
Member

aweosme looking forward to it

@melloware melloware added this to the 10.5.2 milestone Feb 16, 2024
Et7f3 added a commit to Et7f3/primereact that referenced this issue Feb 17, 2024
@melloware melloware added Component: Tailwind Tailwind specific issue and removed Status: In Progress Core Team is working on the issue or pull request labels Feb 17, 2024
Et7f3 added a commit to Et7f3/primereact that referenced this issue Feb 17, 2024
melloware added a commit to melloware/primereact that referenced this issue Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Tailwind Tailwind specific issue
Projects
None yet
2 participants