-
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.
- Loading branch information
1 parent
cebb13f
commit 345b67b
Showing
18 changed files
with
104 additions
and
127 deletions.
There are no files selected for viewing
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -17,7 +17,7 @@ val NavBar = FC { | |
asNavItem() | ||
NavLink { | ||
withClasses("nav-link") | ||
to = "/about" | ||
to = "/" | ||
+"About" | ||
} | ||
} | ||
|
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 was deleted.
Oops, something went wrong.
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,19 +1,30 @@ | ||
package app.pages | ||
|
||
import app.model.HtmlData | ||
import app.model.MdMetadata | ||
import js.import.importAsync | ||
import js.objects.jso | ||
import react.FC | ||
import react.Props | ||
import react.dom.html.ReactHTML.div | ||
import react.useEffect | ||
import react.useState | ||
|
||
external interface InnerHtmlProps : Props { | ||
var data: HtmlData | ||
var data: MdMetadata | ||
} | ||
|
||
val InnerHtml = FC<InnerHtmlProps> { props -> | ||
var content: String? by useState() | ||
|
||
useEffect { | ||
importAsync<dynamic>(props.data.path + "?raw") | ||
.then { content = it.default.unsafeCast<String>() } | ||
.await() | ||
} | ||
|
||
div { | ||
dangerouslySetInnerHTML = jso { | ||
__html = props.data.content | ||
__html = content.orEmpty() | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,40 +1,31 @@ | ||
package app.state | ||
|
||
import app.model.HtmlData | ||
import app.model.MdFileMetadata | ||
import app.model.MdMetadata | ||
import js.import.importAsync | ||
import js.promise.toResult | ||
import kotlinx.serialization.ExperimentalSerializationApi | ||
import kotlinx.serialization.json.Json | ||
import kotlinx.serialization.json.decodeFromDynamic | ||
|
||
data class State(val metadata: MutableList<HtmlData>) { | ||
fun filterByPath(path: String): List<HtmlData> { | ||
return metadata.filter { it.mdFileMetadata.path.startsWith(path) } | ||
data class State(val metadata: MutableList<MdMetadata>) { | ||
fun filterByPath(path: String): List<MdMetadata> { | ||
return metadata.filter { it.path.startsWith(path) } | ||
} | ||
} | ||
|
||
val state = State(mutableListOf()) | ||
|
||
val State.about: HtmlData | ||
val State.about: MdMetadata | ||
get() { | ||
return filterByPath("./pages/about/").first() | ||
} | ||
|
||
val State.posts: List<HtmlData> | ||
val State.posts: List<MdMetadata> | ||
get() = filterByPath("./pages/posts/") | ||
|
||
|
||
@OptIn(ExperimentalSerializationApi::class) | ||
suspend fun initState() = importAsync<dynamic>("./pages/markdown-metadata.yaml") | ||
.then { Json.decodeFromDynamic<List<MdFileMetadata>>(it.default) } | ||
.then { Json.decodeFromDynamic<List<MdMetadata>>(it.default) } | ||
.toResult() | ||
.map { metadataList -> | ||
metadataList.map { metadata -> | ||
importAsync<dynamic>(metadata.path + "?raw") | ||
.then { it.default } | ||
.then { HtmlData(metadata, it) } | ||
.then { state.metadata.add(it) } | ||
.await() | ||
} | ||
} | ||
.onSuccess { state.metadata.addAll(it) } |
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
Binary file not shown.
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,12 @@ | ||
#root { | ||
--voronoi-number-of-cells: 50; | ||
--voronoi-margin: 1%; | ||
--voronoi-line-color: #{$secondary}; | ||
--voronoi-line-width: 1; | ||
--voronoi-dot-size: 0; | ||
--voronoi-cell-colors: #{$primary}; | ||
--voronoi-seed: 643421; | ||
min-height: 100vh; | ||
background-image: paint(voronoi); | ||
background-size: cover; | ||
} |
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,20 @@ | ||
// Single Page Apps for GitHub Pages | ||
// MIT License | ||
// https://github.com/rafgraph/spa-github-pages | ||
// This script checks to see if a redirect is present in the query string, | ||
// converts it back into the correct url and adds it to the | ||
// browser's history using window.history.replaceState(...), | ||
// which won't cause the browser to attempt to load the new url. | ||
// When the single page app is loaded further down in this file, | ||
// the correct url will be waiting in the browser's history for | ||
// the single page app to route accordingly. | ||
(function (l) { | ||
if (l.search[1] === '/') { | ||
var decoded = l.search.slice(1).split('&').map(function (s) { | ||
return s.replace(/~and~/g, '&') | ||
}).join('?'); | ||
window.history.replaceState(null, null, | ||
l.pathname.slice(0, -1) + decoded + l.hash | ||
); | ||
} | ||
}(window.location)) |
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