figma.nestedProps inside figma.className

Aperta
#315 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
figma, typescript
Ambito
tooling

Direzione di ricerca

Start by reading the Code Connect CLI handling for figma.className and figma.nestedProps, then trace how the example receives the resulting className value. Reproduce the reported case with the provided snippet and check how nested size and color values are serialized. Done means the generated class string no longer contains [object Object] and the nested value can be used as intended; the issue does not name files or tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

API question

Please provide:

  • Code Connect CLI version 1.3.4
  • Code Connect file, Figma design and/or relevant code snippet that could help us get more context

Actual code is s

figma.connect('....', {
    props: {
        className: figma.className([
            figma.nestedProps('_tags (main)', {
                size: figma.enum('Size', {
                    md: 'md',
                    sm: 'sm'
                })
            }),
            figma.enum('Color', {
                Black: 'black',
                White: 'white',
                Red: 'red',
                Blue: 'blue'
            })
        ])
    },
    example: ({ className }) => html`<div class="${className}">DIV</div>`
});

Issue is:
Result is

<div class="[object Object] black">TAG</div>

Probably because of "nestedProps"
But thing is:

  • I CAN'T create the className inside "example".
  • I CAN'T use Size outside of nested because ... it's a nested properties
  • I CAN'T update a bit code and do class="${nested.size} ${variant} because the result is class="black" md" (yeah there is a random ")

So the question is, how to fix that ? Is that even fixable ?

Lingua principale
TypeScript
Stelle
1.6k
Fork
126
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di figma/code-connect

Tutte le issue di figma/code-connect

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.