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

[Bug?]: Tailwind not rendering colors passed from prop #995

Closed
2 tasks done
MariuzM opened this issue Aug 11, 2023 · 2 comments
Closed
2 tasks done

[Bug?]: Tailwind not rendering colors passed from prop #995

MariuzM opened this issue Aug 11, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@MariuzM
Copy link

MariuzM commented Aug 11, 2023

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When i pass colors via props it does not render them, checking browser css window its not even there, but if i use styles and pass colors there then it works.

I'm not sure if this is due to Solid way of rendering or i missed something?

I used SolidStart Tailwind template and added this code to test

import { createSignal } from 'solid-js';

export default function Test() {
  return (
    <main>
      <div class="flex flex-col w-fit">
        <DivBaseColorChange />
        <DivPropColorChange color="blue" />
        <DivSignalColorChange />
        <DivStyleColorChange />
      </div>
    </main>
  );
}

const DivBaseColorChange = () => {
  return (
    <div>
      <div>1</div>
      <div class="bg-red-500 w-10 h-10" />
    </div>
  );
};

const DivPropColorChange = (p: { color: 'blue' | 'green' | 'red' | 'yellow' }) => {
  return (
    <div>
      <div>2</div>
      <div class={`bg-${p.color}-500 w-10 h-10`} />
    </div>
  );
};

const DivSignalColorChange = () => {
  const [color, setColor] = createSignal('blue');

  return (
    <div>
      <div>3</div>
      <div class={`bg-${color()}-500 w-10 h-10`} />
    </div>
  );
};

const DivStyleColorChange = () => {
  const [color, setColor] = createSignal('blue');

  return (
    <div>
      <div>4</div>
      <div class="bg-red-500 w-10 h-10" style={{ background: color() }} />
    </div>
  );
};
image
@MariuzM MariuzM added the bug Something isn't working label Aug 11, 2023
@MariuzM
Copy link
Author

MariuzM commented Aug 11, 2023

Maybe not solid issue, i've added custom colors and those seem to work, so looks like Tailwind is removing colors that are conditionally rendered? but is that Tailwind or solid?

image image image

@MariuzM
Copy link
Author

MariuzM commented Aug 11, 2023

@MariuzM MariuzM closed this as completed Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant