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

Nesting Selector(&) Usage in Clay #265

Open
bglgwyng opened this issue Jul 4, 2024 · 3 comments
Open

Nesting Selector(&) Usage in Clay #265

bglgwyng opened this issue Jul 4, 2024 · 3 comments

Comments

@bglgwyng
Copy link

bglgwyng commented Jul 4, 2024

I am looking for a way to use the nesting selector in Clay. I was expecting a syntax similar to the following:

do
  div # ".container" ? do
    -- styles
    self # ".item" ? do
      -- styles
      self ** ".active" ? do
        -- styles

Currently, <? provides partial functionality which is equivalent to self |>, but there doesn’t seem to be a general one. Is there an existing solution for this, or is it something that could be added to Clay?

@turion
Copy link
Collaborator

turion commented Jul 4, 2024

That sounds useful. Isn't that just what https://hackage.haskell.org/package/clay-0.15.0/docs/Clay-Stylesheet.html#v:-38- does?

@bglgwyng
Copy link
Author

bglgwyng commented Jul 5, 2024

They are a bit different. As far as I know, we can't express & .item with & in Clay.
self(=& in CSS) should have its type as Selector, not Refinement -> CSS -> CSS.

@bglgwyng
Copy link
Author

bglgwyng commented Jul 5, 2024

I tried element "*" and it didn't work. The selectors including & should not be flattened. I think we need another tag in Selector.

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