figma / code-connect

A tool for connecting your design system components in code with your design system in Figma
MIT License
485 stars 44 forks source link

Connecting multiple stories in one file to multiple Figma components #35

Open efoken opened 2 weeks ago

efoken commented 2 weeks ago

It would be super helpful, when it would be possible to connect multiple stories in one Storybook file, to different Figma components. Because we do not always have one component that maps to one Figma component, sometimes there are different Figma components but only one component in code, like in this example:

// TextInput.stories.tsx

export const Base: Story = {
  render: (args) => <TextInput {...args} />,
  args: {
    helperText: 'Helper Text',
    label: 'Label',
    placeholder: 'Placeholder',
  },
  parameters: {
    design: {
      type: 'figma',
      url: 'https://...',
      // ...
    },
  },
};

export const Multiline: Story = {
  render: (args) => <TextInput {...args} />,
  args: {
    helperText: 'Helper Text',
    label: 'Label',
    maxRows: 4,
    minRows: 2,
    multiline: true,
  },
  parameters: {
    design: {
      type: 'figma',
      url: 'https://...',
      // ...
    },
  },
};

In Figma we have a TextInput component and a TextArea component, but in React Native code both are the same component.