Skip to content

Commit

Permalink
"Edit this page on GitHub"
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 authored Feb 26, 2024
1 parent c61f5b0 commit d2b1487
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.varabyte.kobweb.compose.foundation.layout.Column
import com.varabyte.kobweb.compose.ui.Alignment
import com.varabyte.kobweb.compose.ui.Modifier
import com.varabyte.kobweb.compose.ui.modifiers.*
import com.varabyte.kobweb.silk.components.navigation.Link
import com.varabyte.kobweb.silk.components.style.ComponentStyle
import com.varabyte.kobweb.silk.components.style.toModifier
import com.varabyte.kobweb.silk.theme.colors.palette.color
Expand Down Expand Up @@ -96,20 +97,25 @@ val MarkdownStyle by ComponentStyle {
fun MarkdownLayout(
title: String,
hamburgerContent: @Composable () -> Unit = {},
outsideContent: @Composable () -> Unit = {},
content: @Composable () -> Unit
) {
PageLayout(title, hamburgerContent = hamburgerContent) {
Column(MarkdownStyle.toModifier().fillMaxSize(), horizontalAlignment = Alignment.Start) {
content()
}
outsideContent()
}
}

// TODO: add "Edit this page on GitHub" link
@Composable
inline fun WikiLayout(title: String, pages: List<WikiPage>, crossinline content: @Composable () -> Unit) {
MarkdownLayout(title, hamburgerContent = {
PageList(pages)
}, outsideContent = {
Column(MarkdownStyle.toModifier().fillMaxSize(), horizontalAlignment = Alignment.Start) {
Link("https://github.com/FrozenBlock/wiki", "Edit this page on GitHub")
}
}) {
content()
}
Expand Down

0 comments on commit d2b1487

Please sign in to comment.