-
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.
Merge pull request #37 from InkApplications/breadcrumbs
Add Breadcrumbs in static renderer
- Loading branch information
Showing
6 changed files
with
61 additions
and
0 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
16 changes: 16 additions & 0 deletions
16
render-static-html/src/main/java/ink/ui/render/statichtml/renderer/BreadcrumbRenderer.kt
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,16 @@ | ||
package ink.ui.render.statichtml.renderer | ||
|
||
import ink.ui.structures.elements.BreadcrumbElement | ||
import kotlinx.html.* | ||
|
||
val BreadcrumbRenderer = renderer<BreadcrumbElement> { element -> | ||
nav { | ||
ul { | ||
element.items.forEach { breadcrumb -> | ||
li { | ||
a(href = breadcrumb.url) { +breadcrumb.text } | ||
} | ||
} | ||
} | ||
} | ||
} |
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,9 @@ | ||
|
||
addPageHeader(TextElement("Page Header", TextStyle.H1)) | ||
addPageHeader(TextElement("Subtitle")) | ||
addPageHeader( | ||
BreadcrumbElement(listOf( | ||
BreadcrumbElement.Breadcrumb("Home", "#"), | ||
BreadcrumbElement.Breadcrumb("Guide", "#guide"), | ||
)) | ||
) |
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
10 changes: 10 additions & 0 deletions
10
structures/src/commonMain/kotlin/ink/ui/structures/elements/BreadcrumbElement.kt
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,10 @@ | ||
package ink.ui.structures.elements | ||
|
||
data class BreadcrumbElement( | ||
val items: List<Breadcrumb>, | ||
): UiElement.Static { | ||
data class Breadcrumb( | ||
val text: String, | ||
val url: String, | ||
) | ||
} |