- About
- Technologies
- Run Locally
- Lessons
- Future app possibilities
- Demo
- Screenshots
- API Reference
- License
Map Sketcher is figma plugin for genereting countries maps.
The UI was created using React App and bundled to Figma Plugin API by webpack.
The user enters the country name, then he's able to genereate map into Preview, if he wants to change the country he simply can do it. After that 'Append Vector' place map into Figma.
- React
- TypeScript
- HTML / CSS
- Figma Plugin API
- different API's to generete GeoJson
- webpack
Clone the project
git clone https://link-to-project
Go to the project directory
cd my-project
Install dependencies
npm install
build
npm run build
Start the server
npm run start
Watch tsconfig file
Ctrl+Shift+B
In Figma: Plugins -> Development -> import from manifest
-
I practiced bundling files with webpack. I needed to figure out how to organize my files, place entry point correctly. The entry point for UI :
dist/ui.html
, and for figma plugin:dist/code.js
-
Figma Plugin works with iframe and sandbox. The sandbox is the Figma plugin side of my application (
code.ts
) which has access to Figma layers. It gets message viaonmessage
from UI. My UI created in React (ui.tsx
) uses iframe. It has access to browser API's, user input and it communicate with the plugin bypostMessage
. -
The problem I faced was not able to get by country name the geojson file from
geoBundaries.org
API. They required country ISO. I needed to take user input and get country ISO from other API, then pass that to the geoBundaries API. -
To convert geoJSON to SVG path, I used npm package:
geojson2svg
. I was able to pass it to Figma and then create node. -
I had a conflict issuse with @figma/plugin-typings and the other file in index.d.ts. for
fetch
andconsole
method. They were defined in two files so I needed to comment the definition in one of the files.
There are possibilities to expand app for more features like:
- support for more administrative areas, e.g.: states & counties
- adding a world map for easier area selection
- selecting multiple regions at once
map_sketcher.mov
restcountries.com
geoboundaries.org