-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/additionally fetch header and footer to the context in previe…
…w mode to resolve header ad footer later (#57)
- Loading branch information
1 parent
46df51e
commit e363e46
Showing
6 changed files
with
64 additions
and
5 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
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,27 @@ | ||
import type { ISbStoryData } from "@storyblok/react/rsc"; | ||
|
||
export function getHeaderAndFooterStories( | ||
stories: ISbStoryData[], | ||
header: string | ISbStoryData, | ||
footer: string | ISbStoryData, | ||
) { | ||
let resolvedHeader: ISbStoryData | undefined; | ||
let resolvedFooter: ISbStoryData | undefined; | ||
|
||
if (typeof header === "string") { | ||
resolvedHeader = stories.find((s) => s.uuid === header); | ||
} else { | ||
resolvedHeader = header; | ||
} | ||
|
||
if (typeof footer === "string") { | ||
resolvedFooter = stories.find((s) => s.uuid === footer); | ||
} else { | ||
resolvedFooter = footer; | ||
} | ||
|
||
return { | ||
header: resolvedHeader, | ||
footer: resolvedFooter, | ||
}; | ||
} |
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