`figma connect preview` support for nested components props

Aberta
#412 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
54/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
figma, typescript

Direção de pesquisa

Start by locating the figma connect preview command and the code that builds the --inspect and --output json property lists. Check how nested component instances are represented in the Figma data and compare that with the current boolean output for “Assistive text.” Done means both preview formats report nested component properties accurately so they can be used to test templates.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

feature request

Recently I started to experiment with the CLI preview feature and notice it can only receive props that belong strictly to the component.

Often my team designers share components that rely on nested instances. See in the image below the "Assistive text" nested component:

Image

As you can see in the image below, the nested component value is a relevant prop for the component code:

Image

When I run the preview command with the --inspect flag, Assistive text is represented as a boolean, which is not the case - it's a nested component.

● components.figma.batch.json (198:33673)
  Name                      Type     Options                                      Default
  ------------------------  -------  -------------------------------------------  ---------
  [𝐓] Label                Text                                                  "Label"
  Trailing label (Default)  Boolean  true | false                                 true
  Assistive text            Boolean  true | false                                 false
  Leading label             Boolean  true | false                                 false
  Selection                 Variant  None | Selected | Partial                    "None"
  State                     Variant  Default | Hover | Active | Focus | Disabled  "Default"
  Error                     Variant  True | False                                 "False"

Similar output is generated with --output json:

[
  {
    "filePath": "components.figma.batch.json",
    "nodeId": "198:33673",
    "availableProperties": [
      {
        "name": "[𝐓] Label",
        "type": "TEXT",
        "default": "Label"
      },
      {
        "name": "Trailing label (Default)",
        "type": "BOOLEAN",
        "default": true
      },
      {
        "name": "Assistive text",
         "type": "BOOLEAN",
        "default": false
      },
      {
        "name": "Leading label",
        "type": "BOOLEAN",
        "default": false
      },
      {
        "name": "Selection",
        "type": "VARIANT",
        "variantOptions": [
          "None",                                                                                       "Selected",
          "Partial"
        ],
        "default": "None"
      },
      {
        "name": "State",
        "type": "VARIANT",
        "variantOptions": [
          "Default",
          "Hover",
          "Active",
          "Focus",
          "Disabled"
        ],
        "default": "Default"
      },
      {
        "name": "Error",
        "type": "VARIANT",
        "variantOptions": [
          "True",
          "False"
        ],
        "default": "False"
      }                                                                                           ]
  }
]

Being able to test the templates with the nested component values is quite relevant for our team to ensure these are working as we designed them.

Linguagem predominante
TypeScript
Estrelas
1.6k
Forks
126
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de figma/code-connect

Todas as issues de figma/code-connect

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.