-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): allow stories to be rendered in the main frame with the sto…
…ry option
- Loading branch information
Showing
13 changed files
with
142 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useStoryLiteStore } from '@/app/stores/global' | ||
import { parametersToDataProps } from '@/utility/parametersToDataProps' | ||
|
||
import { CanvasIframe } from './CanvasIframe' | ||
import { CanvasIframeBody } from './CanvasIframeBody' | ||
|
||
export function CanvasRoot({ storyId }: { storyId?: string }) { | ||
const [stories, defaultStory, currentParams] = useStoryLiteStore(state => [ | ||
state.stories, | ||
state.config.defaultStory, | ||
state.parameters, | ||
]) | ||
|
||
const _storyId = storyId ?? defaultStory | ||
|
||
const renderFrame = stories.get(_storyId)?.renderFrame ?? 'iframe' | ||
const paramsDataProps = parametersToDataProps(currentParams) | ||
|
||
if (renderFrame === 'root') { | ||
return ( | ||
<div id="storylite_canvas_root" className="storylite-canvas-root" {...paramsDataProps}> | ||
<CanvasIframeBody storyId={_storyId} /> | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<div id="storylite_canvas_root" className="storylite-canvas-root" {...paramsDataProps}> | ||
<CanvasIframe storyId={_storyId} /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { CanvasIframe } from '@/components/canvas/CanvasIframe' | ||
import { CanvasRoot } from '@/components/canvas/CanvasRoot' | ||
import TopFrameLayout from '@/components/layouts/TopFrameLayout' | ||
|
||
export default function HomePage() { | ||
return <CanvasIframe /> | ||
return <CanvasRoot /> | ||
} | ||
|
||
export const Layout = TopFrameLayout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
import { CanvasIframe } from '@/components/canvas/CanvasIframe' | ||
import { CanvasRoot } from '@/components/canvas/CanvasRoot' | ||
import TopFrameLayout from '@/components/layouts/TopFrameLayout' | ||
import { SLStoryPageProps } from '@/types' | ||
|
||
export default function StoryPage({ storyId }: SLStoryPageProps) { | ||
if (!storyId) { | ||
return <div>Error: story route segment is empty</div> | ||
} | ||
|
||
return <CanvasIframe storyId={storyId} /> | ||
return <CanvasRoot storyId={storyId} /> | ||
} | ||
|
||
export const Layout = TopFrameLayout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
[data-sl-outline='true'] | ||
.storylite-story-component | ||
:where(div, section, article, aside, header, footer, form, table, ul, ol, details) { | ||
outline: 1px solid rgba(255, 87, 126, 0.5) !important; | ||
:where(div, section, article, aside, header, footer, form, table, ul, ol, details, pre) { | ||
outline: 2px solid rgba(255, 87, 126, 0.65) !important; | ||
outline-offset: 0px !important; | ||
} | ||
|
||
[data-sl-outline='true'] .storylite-story-component :where(a, button, input, textarea, select) { | ||
outline: 1px solid rgba(255, 230, 9, 0.7) !important; | ||
outline: 2px solid rgba(255, 230, 9, 0.65) !important; | ||
outline-offset: 0px !important; | ||
} | ||
|
||
[data-sl-outline='true'] | ||
.storylite-story-component | ||
:where(span, i, image, svg, canvas, video, audio) { | ||
outline: 1px solid rgba(87, 238, 49, 0.5) !important; | ||
:where(span, i, image, svg, canvas, video, audio, var, code) { | ||
outline: 2px solid rgba(87, 238, 49, 0.65) !important; | ||
outline-offset: 0px !important; | ||
} | ||
|
||
[data-sl-outline='true'] .storylite-story-component :where(li, dt, dd, tr, th, td, summary) { | ||
outline: 1px solid rgba(55, 202, 255, 0.5) !important; | ||
outline: 2px solid rgba(55, 202, 255, 0.65) !important; | ||
outline-offset: 0px !important; | ||
} | ||
|
||
[data-sl-outline='true'] .storylite-story-component :where(h1, h2, h3, h4, h5, h6) { | ||
outline: 1px solid rgba(255, 111, 0, 0.5) !important; | ||
outline: 2px solid rgba(255, 111, 0, 0.65) !important; | ||
outline-offset: 0px !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters