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

What is the purpose of class go11? #7

Open
Profesor08 opened this issue Nov 30, 2021 · 2 comments
Open

What is the purpose of class go11? #7

Profesor08 opened this issue Nov 30, 2021 · 2 comments

Comments

@Profesor08
Copy link

Profesor08 commented Nov 30, 2021

A lot of elements has class name go11. This make a lot of conflicts if element don't has some styles, and I want to apply them to it depending on some parent. Every unique element must have his own unique className.

const WeatherWidget = styled<"div">(({ ...props }) => {
  <WidgetContainer {...props}>...</WidgetContainer>;
})``;

export const Weather = styled<"div">(({ ...props }) => {
  return (
    <Show when={store.showWeatherWidget}>
      <WeatherWidget {...props} />
    </Show>
  );
})``;

export const Header = styled("div")`
  display: grid;
  grid-template-columns: 30px 280px auto 1fr;
  align-items: start;
  gap: 32px;

  ${Weather.className} {
    grid-column: 2 / 4;
  }
`;

image
image

@ryansolid
Copy link
Member

I think this something Goober does. It's the library we use under the hood. I think they might have more info in their docs: https://github.com/cristianbote/goober

@Profesor08
Copy link
Author

Profesor08 commented Nov 30, 2021

I think this something Goober does. It's the library we use under the hood. I think they might have more info in their docs: https://github.com/cristianbote/goober

May be you right, may be not. Goober generates unique classname for unique block of styles. And for empty block of styled, it generate class name go11. There is nothing special. But the way in witch it nesting styles is different. And I there is the issue, I think.

There is an simple example: https://codesandbox.io/s/solidjs-zdeu5?file=/src/App.tsx

import { styled } from "solid-styled-components";

const ChildA = styled("div")``;

const ChildB = styled("div")``;

const Parent = styled("div")`
  &:hover {
    ${ChildA.className} {
      color: red;
    }

    ${ChildB.className} {
      color: blue;
    }
  }
`;

export const App = () => {
  return (
    <Parent>
      <ChildA>ChildA</ChildA>
      <ChildB>ChildB</ChildB>
    </Parent>
  );
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants