Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: query-parameters persisting when opening a story on a full-view-mode #1845

Merged
merged 7 commits into from
Jan 30, 2024
Merged
13 changes: 8 additions & 5 deletions .storybook/preview.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import '../src/tailwind.css'
import './sb-theming.css'
import { ToC } from '@docs/helpers/ToC'

import { DocsContainer } from '@storybook/blocks'
import { withThemeByDataAttribute } from '@storybook/addon-styling'
import { Icon } from '@spark-ui/icon'
import { ShareExpand } from '@spark-ui/icons/dist/icons/ShareExpand'

import '../src/tailwind.css'
import './sb-theming.css'
import { ToC } from '@docs/helpers/ToC'

const ExampleContainer = ({ children, ...props }) => {
return (
<DocsContainer {...props}>
Expand Down Expand Up @@ -51,12 +51,15 @@ export const decorators = [
attributeName: 'data-theme',
}),
(storyFn, { id, viewMode }) => {
const params = new URLSearchParams(window.top?.location.search)
params.set('id', id)
params.delete('path')
return (
<div className="relative w-full">
{viewMode === 'docs' && (
<div className="absolute -right-lg -top-xl">
<a
href={`/iframe.html?&id=${id}`}
href={`/iframe.html?${params.toString()}`}
target="_blank"
className="text-basic hover:text-basic-hovered focus:text-basic-focused enabled:active:text-basic-pressed"
>
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading