summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-08-26 14:09:53 +0200
committernea <romangraef@gmail.com>2022-08-26 14:09:53 +0200
commited931bbb10219b573b6227631bf3600319367ec4 (patch)
tree5a79cc3050bb0c11afbb6eebefdc5c1767b72f2b /example
parent6207fd482a685527fda286e0df5d4fa87aa85149 (diff)
downloadneamoe-ed931bbb10219b573b6227631bf3600319367ec4.tar.gz
neamoe-ed931bbb10219b573b6227631bf3600319367ec4.tar.bz2
neamoe-ed931bbb10219b573b6227631bf3600319367ec4.zip
move shit around
Diffstat (limited to 'example')
-rw-r--r--example/src/main/kotlin/moe/nea89/website/test/index.kt25
1 files changed, 22 insertions, 3 deletions
diff --git a/example/src/main/kotlin/moe/nea89/website/test/index.kt b/example/src/main/kotlin/moe/nea89/website/test/index.kt
index 9fdb2c1..c558868 100644
--- a/example/src/main/kotlin/moe/nea89/website/test/index.kt
+++ b/example/src/main/kotlin/moe/nea89/website/test/index.kt
@@ -2,11 +2,13 @@ package moe.nea89.website.test
import kotlinext.js.require
import kotlinx.browser.document
+import kotlinx.css.*
import kotlinx.html.dom.append
import kotlinx.html.dom.create
import kotlinx.html.img
import kotlinx.html.js.a
import kotlinx.html.js.div
+import kotlinx.html.js.onLoadFunction
import kotlinx.html.js.p
import moe.nea89.website.*
import styled.injectGlobal
@@ -31,11 +33,26 @@ val defaultFileSystem = fileSystem {
fun main() {
require("@fontsource/comic-mono/index.css")
- injectGlobal(Styles.global)
val root = document.body!!.append.div()
val console = KConsole.createFor(root, fileSystem = defaultFileSystem)
+ console.text.id = "myconsole"
+ injectGlobal {
+ body {
+ backgroundColor = Styles.bgColor.lighten(30)
+ }
+ ".${Styles.consoleClass}" {
+ margin(LinearDimension.auto)
+ width = 50.vw
+ height = 50.vh
+ marginTop = 25.vh
+ boxSizing = BoxSizing.borderBox
+ backgroundClip = BackgroundClip.contentBox
+ overflowY = Overflow.scroll
+ }
+
+ }
console.addLine("Starting up terminal.")
- console.PS1 = ">"
+ console.PS1 = { "${this.fileAccessor?.currentDir?.joinToString("/", "/") ?: ""} >" }
console.rerender()
console.registerCommand(command("cwd", "pwd") {
val fa = requireFileAccessor()
@@ -104,7 +121,9 @@ fun main() {
is KFile.Directory -> console.addLine("cat: Is a directory")
is KFile.Text -> console.addMultilineText(file.text)
is KFile.Image -> console.addLine(document.create.p {
- img(src = file.url)
+ img(src = file.url) {
+ this.onLoadFunction = { console.scrollDown() }
+ }
})
is KFile.Download -> {