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

Translating :checked and + #131

Closed
WorldsEndless opened this issue Mar 23, 2017 · 7 comments
Closed

Translating :checked and + #131

WorldsEndless opened this issue Mar 23, 2017 · 7 comments

Comments

@WorldsEndless
Copy link
Collaborator

I can't seem to figure out how to generate this selector:

.onoffswitch-checkbox:checked + .onoffswitch-label

I've tried variations, e.g.
(garden.core/css [:div [:&s/checked {:foo :bar}]])

(garden.core/css [:div (s/checked) {:foo :bar}])

but no luck. A little help?

@WorldsEndless
Copy link
Collaborator Author

This is the closest I've come, but the :checked is in the wrong place:

(garden.core/css [(s/+ (s/checked :.onoffswitch-checkbox) :.onoffswitch-label) {:background-color 'white}])
:checked.onoffswitch-checkbox + .onoffswitch-label {
  background-color: white;
}

@WorldsEndless
Copy link
Collaborator Author

Almost got it...

(garden.core/css [(s/+  (s/checked :onoffswitch-checkbox)
                                    :.onoffswitch-label) {:background-color 'white}])
:checkedonoffswitch-checkbox + .onoffswitch-label {
  background-color: white;
}

@hkjels
Copy link

hkjels commented Mar 24, 2017

I'm pretty sure this works:

[(s/+ :.onoffswitch-checkbox:checked :.onoffswitch-label) {}]

Also, if you don't need to do anything programatically to the selector, you can actually use the string-variant.

@WorldsEndless
Copy link
Collaborator Author

Thanks! What do you mean the "string-variant"?

@hkjels
Copy link

hkjels commented Mar 24, 2017

[".onoffswitch-checkbox:checked + .onoffswitch-label" {}]

@hkjels
Copy link

hkjels commented Mar 24, 2017

Note that I think #127 applies to (s/+) as well as (s/>), so the combination of (s/&) and (s/+) might not work

@WorldsEndless
Copy link
Collaborator Author

I had no idea of that "string variant"! That completely changes my converting-css-to-Garden life!

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