diff --git a/.gitignore b/.gitignore index 353c174b..8dab4010 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Project -dist/ +build/ .ref/ TODO.md diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..3301228e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "json.schemas": [ + { + "fileMatch": [ + "package.json" + ], + "url": "https://yuanqing.github.io/create-figma-plugin/figma-plugin.json" + } + ] +} diff --git a/README.md b/README.md index b0558eb2..77a4c6f2 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,22 @@ -# [Figma To React Native](https://www.figma.com/community/plugin/821138713091291738) - -> Transforms Figma components to React Native components in real time. The goal is to reduce the handoff time between design and development. Design your UI components in Figma and export them for use in your React Native app. The focus is on one way, continuous, conversion from Figma to React. +

+ +

+

+ Figma → React Native +

+

+ + View plugin on Figma Community + +

+ +This plugin transforms Figma components to React Native components in real time. The goal is to reduce the handoff time between design and development. Design your UI components in Figma and export them for use in your React Native app. [![Preview of plugin](./art/banner.png)](https://www.figma.com/community/plugin/821138713091291738) ## Getting started -[Install the plugin](https://www.figma.com/community/plugin/821138713091291738). Open it in Figma and select a [Figma component](https://help.figma.com/hc/en-us/articles/360038662654-Guide-to-Components-in-Figma). The plugin will generate React component code and render a preview. To change the settings, click the cog icon and edit the JSON. Settings will save and update in real time. You can change the configuration of the editor, plugin, compiler, code output, and more. +[Run the plugin](https://www.figma.com/community/plugin/821138713091291738). Open it in Figma and select a [Figma component](https://help.figma.com/hc/en-us/articles/360038662654-Guide-to-Components-in-Figma). The plugin will generate React component code and render a preview. To change the settings, click the cog icon and edit the JSON. Settings will save and update in real time. You can change the configuration of the editor, plugin, compiler, code output, and more. ## Features @@ -18,8 +28,9 @@ - Background gradients - Borders and rounding - Shadows and rotations +- Storybook generation +- Component JSDoc generation - Theme generation from styles -- Generates stories for Storybook - Realtime code and preview rendering - Flexible and realtime configuration - Batch exporting components @@ -31,3 +42,5 @@ - [Figma Forums](https://forum.figma.com/t/react-component-generator/14236) - [Discussions](https://github.com/kat-tax/figma/discussions) - [Issues](https://github.com/kat-tax/figma/issues) + +This plugin is open source. It does not require an account, remote service, or any other bullsh*t. diff --git a/ROADMAP.md b/ROADMAP.md index 0840ea73..66bb6916 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,24 +1,20 @@ # ROADMAP -### Polishing -- Add fill prop to SVGs and provide them -- Fix wrong variants being used (imports seem right) +### Next +- Fix handling multiple variants - Fix various parse errors - Fix styling differences +- Fix sanitizing names +- Fix rectangle + ellipses +- Support assets (png + svg) +- Support variant child nodes -### Interfacing - +### Interface +- Diff text instead of fully replacing (highlight changes?) - Highlight selected sub node within code - sourcemap from node ids -> line + column numbers needed when parsing -### Generating - -- Variants - - Loop through variants - - Build and diff stylesheet from the root for each - - Add suffix (named from the variant) for each diff stylesheet - - Build the dynamic class with the props and the stylesheet classes - - If state is "Hover" or "Focused" or "Pressed" then auto generate a and apply the class? +### Generation - Images (including export & previewing) - Expo Image support: https://docs.expo.dev/versions/unversioned/sdk/image/ - Generate placeholder: https://github.com/evanw/thumbhash @@ -29,23 +25,41 @@ - Absolute positioning - Interactions (via Pressable & Link) - Screens (navigation based on prototype settings) +- Use Pressable and TextInput using user mappings +```json +{ + "mappings": { + // Hovers get a pressable generated over them + "PressableContainer": "/$button|^button/i", + // Hovers get a pressable generated over them + "PressableHover": "/$button|^button/i", + // Inputs get Text replaced with TextInput and contents are the placeholder attr + "TextInput": "/$input|^input/i", + } +} +``` +- Auto generate a and apply "Hover" or "Focused" or "Pressed" state? +```tsx + + {({hovered}) => ( +