diff --git a/packages/histoire/src/client/app/components/sandbox/lib.ts b/packages/histoire/src/client/app/components/sandbox/lib.ts new file mode 100644 index 00000000..33b63825 --- /dev/null +++ b/packages/histoire/src/client/app/components/sandbox/lib.ts @@ -0,0 +1,8 @@ +import { Story, Variant } from '../../types' + +export function getSandboxUrl (story: Story, variant: Variant) { + const url = new URLSearchParams() + url.append('storyId', story.id) + url.append('variantId', variant.id) + return '/__sandbox?' + url.toString() +} diff --git a/packages/histoire/src/client/app/components/story/StoryResponsivePreview.vue b/packages/histoire/src/client/app/components/story/StoryResponsivePreview.vue index cd8da3d6..b2005f8c 100644 --- a/packages/histoire/src/client/app/components/story/StoryResponsivePreview.vue +++ b/packages/histoire/src/client/app/components/story/StoryResponsivePreview.vue @@ -9,6 +9,7 @@ import HatchedPattern from '../misc/HatchedPattern.vue' import CheckerboardPattern from '../misc/CheckerboardPattern.vue' import { toRawDeep } from '../../util/reactivity' import { Settings } from 'http2' +import { getSandboxUrl } from '../sandbox/lib' const props = defineProps<{ story: Story @@ -61,10 +62,7 @@ useEventListener(window, 'message', (event) => { }) const sandboxUrl = computed(() => { - const url = new URLSearchParams() - url.append('storyId', props.story.id) - url.append('variantId', props.variant.id) - return '/__sandbox?' + url.toString() + return getSandboxUrl(props.story, props.variant) }) const isIframeLoaded = ref(false) diff --git a/packages/histoire/src/client/app/components/story/StoryVariantSingleView.vue b/packages/histoire/src/client/app/components/story/StoryVariantSingleView.vue index 3149874b..0947b7d2 100644 --- a/packages/histoire/src/client/app/components/story/StoryVariantSingleView.vue +++ b/packages/histoire/src/client/app/components/story/StoryVariantSingleView.vue @@ -1,24 +1,18 @@ @@ -33,141 +27,13 @@ const settings = usePreviewSettings() v-if="!isMobile" class="htw-flex-none htw-flex htw-items-center htw-h-8 -htw-mt-1" > - -