-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(documentation): add possibility to open all demos full screen (#…
- Loading branch information
1 parent
ceb9cb1
commit 0e8e27b
Showing
4 changed files
with
28 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-documentation': patch | ||
--- | ||
|
||
Added the possibility to open each demo in full screen. |
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,3 +1,4 @@ | ||
export * from './bages-config'; | ||
export * from './open-full-screen-demo'; | ||
export * from './prettier-options'; | ||
export * from './reset-sb-styled-components'; |
12 changes: 12 additions & 0 deletions
12
packages/documentation/.storybook/helpers/open-full-screen-demo.ts
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,12 @@ | ||
export const openFullScreenDemo = (e: Event) => { | ||
const target = e.target as HTMLButtonElement; | ||
const canvas = target.closest('.docs-story'); | ||
const story = canvas?.querySelector('.sb-story'); | ||
const iframeId = story?.id?.replace('story--', ''); | ||
|
||
if (iframeId) { | ||
window.open(`/iframe.html?id=${iframeId}`,'_blank'); | ||
} else { | ||
alert('The full screen demo is not available.'); | ||
} | ||
}; |
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