PavelLaptev / JSON-to-Figma

An easy way to populate Figma layers with JSON
MIT License
140 stars 39 forks source link

Fill in random order: do not fill recurring keys randomly #47

Open habenbam opened 2 years ago

habenbam commented 2 years ago

Scenario

I create the design for an item detail page of an e-commerce shop in Figma. Some information, such as the brand name of a product, is used in several places on the page. I have a JSON file with different products. I now want to fill the page with a random article from the JSON file. Suppose there is a key brandName in the JSON and all the layers in Figma that should display the brand name are named after this key.

Problem

When I select the option Populate in random order to populate the page with a random item, I have a different brand name for each layer named brandName. However, all occurrences of brandName should be given the same brand name, chosen at random. The problem then also occurs for all other keys. As a result, the information no longer fits together.

Possible solution

If the keys are selected randomly (Populate in random order), I can decide whether the randomly selected key from the JSON should apply to all matching layers in Figma. Maybe this is helpful for others as well? I'm not sure if the wording in the UI is appropriate.

πŸ‘‰ Please see my (forked) feature branch.

πŸ‘‡ An example where the key "name" is used twice. Using this json-test-file.

https://user-images.githubusercontent.com/6816666/182153460-84f99b17-6c4f-4082-aaf8-80a8d6134c78.mov


Thank you for developing this plugin πŸ™

PavelLaptev commented 1 year ago

@habenbam thank you for your issue. I'm currently rewriting the plugin and this will be really helpful. Thank you