stylist-rs icon indicating copy to clipboard operation
stylist-rs copied to clipboard

Do we support defining pseduo class with this library?

Open Mng12345 opened this issue 1 year ago • 3 comments

As the title, there is no documentation i can find about how to use pseduo class in stylist-rs.

Mng12345 avatar Aug 18 '22 02:08 Mng12345

Yes, this is supported. E.g. in a styled component

let hover_class = css!(
  :hover {
      color: blue;
  }
);

You can think of all selectors in a css! block to implicitly mention "the currently generated class", so the above results in css like

.stylist-style-0:hover {
    color: blue;
}

being mounted the <head> and using the hover_class will attach the class stylist-style-0 to your component.

WorldSEnder avatar Aug 18 '22 13:08 WorldSEnder

@WorldSEnder Thanks, but it's still not very clear to me, could you put an example into the directory examples of this repository?

Mng12345 avatar Aug 19 '22 01:08 Mng12345

Can you give a short description what you are trying to achieve and which pseudo class you would like to see, so I can provide a tailored example?

WorldSEnder avatar Aug 19 '22 12:08 WorldSEnder