-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
Bugs with selectors and multiple elements #72
Comments
I ran into the same issue, and considered trying to add the following:
Input CSS[data-card-variant="primary"] {
background-color: green;
color: white;
} Output TypeScriptdeclare namespace React {
interface HTMLAttributes {
"data-card-variant"?: "primary";
}
} Not quite sure how viable these ideas are, or whether they conflict with the core principles of Mist. But they are certainly how I intuitively want to use the tool. I haven't had much time to work on a PR yet. |
Hey, First of all, thanks a lot for the review and this feedback. I must admit I've not considered doing it this way. Basically, I considered how visual components are written and translated it to CSS (simplified example): function Button(props) { return <button className={props...}>... }
function AnotherButton(props) { return <button className={props...}>... button { &[data-props] { /* ... */ } }
button[data-component="anotherButton"] { &[data-props] { /* ... */ } } The first In this regard, you need to structure your CSS just like you would your React components which is familiar to devs but could be made more DRY in CSS. This is a convention that has pros and cons. I'd like to keep it for the moment as it may be useful to have one to make it easier to build other features on top of it (goto definition for example #73). I'm not sure to understand this use case:
If it's applied to all tags then, for example, That said I'm always curious about better understanding how MistCSS is used and if there are things that could be improved. |
I think Or a common use case I have is heading elements: [data-heading="gradient-text"]:is(h1,h2,h3,h4,h5,h6) { ... } not a huge deal, but these kinds of papercuts are what cause people to use non-semantic elements and we end up with click handlers on divs |
Great lib! A few issues and suggestions, all revolving around some valid CSS selectors.
First, I'd like to be able to specify something like this and have it available to all elements:
On it's own it generates nothing.
When there is a selector above it, it merges it:
Sticks them all on button:
I tried a few different ways to select multiple elements.
Nothing is generated for for this:
This one generates the interfaces for all elements, but only applies it to the last one:
As does this:
I did get this to work, but it's not very scalable:
The text was updated successfully, but these errors were encountered: