prismicio / slice-simulator

Preview and develop Prismic slices fast with minimal configuration
6 stars 5 forks source link

feat: provide a way to flag the `<SliceZone />` component (or its wrapper) #5

Closed lihbr closed 2 years ago

lihbr commented 2 years ago

Is your feature request related to a problem? Please describe.

Currently, detection of the <SliceZone /> component (or its wrapper in case it only renders children like the one from @prismicio/react) is a bit hacky and could break/be inconsistent in some edge cases (e.g. users decide to render additional elements along the <SliceZone /> in its simulator).

Describe the solution you'd like

To deal with edge-cases, users could have the ability flag the <SliceZone /> component (or its wrapper) with a class (.slice-simulator-slicezone or (strict, TBD) a data attribute (data-slicezone). This flag would then be preferred when resolving the <SliceZone /> component or its wrapper.

Describe alternatives you've considered

The simulator could take care of rendering this <SliceZone /> component itself. However this limits the ability of users to wrap their <SliceZone /> component with containers or similar, like they might be doing in their applications.

Additional context

/