Skip to content

Commit d3fa178

Browse files
committed
Expose overlay config to platform story Composables
1 parent cd1c932 commit d3fa178

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

  • storyboard-easel/src

storyboard-easel/src/jvmMain/kotlin/dev/bnorm/storyboard/easel/DesktopStory.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import dev.bnorm.storyboard.easel.export.ExportProgressPopup
1818
import dev.bnorm.storyboard.easel.export.StoryboardPdfExporter
1919
import dev.bnorm.storyboard.easel.notes.StoryNotes
2020
import dev.bnorm.storyboard.easel.overlay.OverlayNavigation
21+
import dev.bnorm.storyboard.easel.overlay.StoryOverlayScope
2122
import kotlinx.coroutines.launch
2223

2324
@OptIn(ExperimentalStoryStateApi::class)
@@ -35,7 +36,12 @@ fun ApplicationScope.DesktopStory(storyboard: Storyboard) {
3536
*/
3637
@Composable
3738
@ExperimentalStoryStateApi
38-
fun ApplicationScope.DesktopStory(storyState: StoryState) {
39+
fun ApplicationScope.DesktopStory(
40+
storyState: StoryState,
41+
overlay: @Composable StoryOverlayScope.() -> Unit = {
42+
OverlayNavigation(storyState)
43+
},
44+
) {
3945
val notes = remember { StoryNotes() }
4046
val desktopState = rememberDesktopState(storyState.storyboard)
4147

@@ -89,7 +95,7 @@ fun ApplicationScope.DesktopStory(storyState: StoryState) {
8995
overlay = {
9096
// Only display overlay navigation when *not* fullscreen.
9197
if (desktopState.storyboard.placement != WindowPlacement.Fullscreen) {
92-
OverlayNavigation(storyState)
98+
overlay()
9399
}
94100
},
95101
modifier = Modifier.fillMaxSize()

storyboard-easel/src/wasmJsMain/kotlin/dev/bnorm/storyboard/easel/WebStory.kt

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import dev.bnorm.storyboard.core.ExperimentalStoryStateApi
1111
import dev.bnorm.storyboard.core.StoryState
1212
import dev.bnorm.storyboard.core.Storyboard
1313
import dev.bnorm.storyboard.easel.overlay.OverlayNavigation
14+
import dev.bnorm.storyboard.easel.overlay.StoryOverlayScope
1415
import kotlinx.browser.window
1516
import org.w3c.dom.url.URL
1617
import org.w3c.dom.url.URLSearchParams
@@ -35,7 +36,20 @@ fun WebStory(storyboard: Storyboard) {
3536
it.updateStoryboard(storyboard)
3637
}
3738
}
38-
val overview = remember(storyboard) {
39+
40+
WebStory(storyState)
41+
}
42+
43+
@Composable
44+
fun WebStory(
45+
storyState: StoryState,
46+
overlay: @Composable StoryOverlayScope.() -> Unit = {
47+
OverlayNavigation(storyState)
48+
},
49+
) {
50+
// TODO should we be exposing overview as a param?
51+
// - we don't support this on desktop...
52+
val overview = remember(storyState) {
3953
val params = URLSearchParams(window.location.search.toJsString())
4054

4155
StoryOverview.of(storyState).apply {
@@ -52,7 +66,7 @@ fun WebStory(storyboard: Storyboard) {
5266
overview = overview,
5367
overlay = {
5468
// TODO if this is a mobile device, prefer touch navigation
55-
OverlayNavigation(storyState)
69+
overlay()
5670
},
5771
modifier = Modifier.fillMaxSize()
5872
.background(MaterialTheme.colors.background),

0 commit comments

Comments
 (0)