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

support multiple value for one style in UIDLElementNode? #761

Open
MurakamiKennzo opened this issue Apr 6, 2023 · 3 comments
Open

support multiple value for one style in UIDLElementNode? #761

MurakamiKennzo opened this issue Apr 6, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@MurakamiKennzo
Copy link
Contributor

Hi, thanks for the project, I'm happy to using it in my project, but currently, I find some problems.

I wanna generate css varibles, but there are some limits for me.

like this:

{
  "name": "Token Simple",
  "node": {
    "type": "element",
    "content": {
      "elementType": "container",
      "style": {
        "margin": {
          "type": "dynamic",
          "content": {
            "referenceType": "token",
            "id": "space-2"
          }
        }
      },
      "children": []
    }
  }
}

the uidl will generate a style like this:

.container {
  margin: var(--space-2);
}

It's great!😀

But, I wanna a style like this:

.container {
  margin: var(--space-2) var(--space-4);
}

what should I do? currently it may not support.

help wanted, Thanks!🥰

@JayaKrishnaNamburu
Copy link
Member

Hey, that's a very interesting requirement. I think we can work our way around this with static nodes. But, with tokens maybe we should change the referenceType to array to make styles refer to multiple dynamic values. Will look into this. Is this blocking any of your requirements currently ?

@JayaKrishnaNamburu JayaKrishnaNamburu added the enhancement New feature or request label Apr 19, 2023
@MurakamiKennzo
Copy link
Contributor Author

MurakamiKennzo commented Apr 19, 2023

No, It's not urgent. I just find a problem when i using css shorthand. Currently I split it and solved.

Maybe like this:

{
  "name": "Token Simple",
  "node": {
    "type": "element",
    "content": {
      "elementType": "container",
      "style": {
        "margin": {
          "type": "list",
          "content": [
            {
              "type": "dynamic",
              "content": {
                "referenceType": "token",
                "id": "space-2"
              }
            },
            {
              "type": "dynamic",
              "content": {
                "referenceType": "token",
                "id": "space-4"
              }
            },
            // {
            //   "type": "static",
            //   "content": 16
            // }
          ]
        }
      },
      "children": []
    }
  }
}

Hopes your solution here.

@JayaKrishnaNamburu
Copy link
Member

cool, i will look into this in the coming days then. It should definitely doable 👍

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

No branches or pull requests

2 participants