JetBrains / react-buddy-ide-toolbox

@react-buddy/ide-toolbox and palette packages
Apache License 2.0
60 stars 5 forks source link

Ability to preview a component from palette #1

Closed web-devel closed 2 years ago

karandashovrz commented 2 years ago

To use preview for components from palette, net to do: 1) install @react-buddy/ide-toolbox with version 1.1.0-dev.0 2) import palette component with palette tree from "palette.tsx" and add it in jsx element form to property palette to Preview component. image

3) run dev-server with env variable REACT_APP_IDE_DEVMODE=true

Routing for palette component: All routes for palette component start with /REACT_BUDDY_PALETTE. Next comes "/" + category name (located in name property in "Category" component). Next - "/" + component name (located in name property in "Component" component). Finaly - "/" + variant name (located in name property in "Variant" component). If variant component hasn't name property, need to use value DEFAULT_VARIANT. Note: result route path must be processed by encode url function.