Skip to content

Commit 13a5b6d

Browse files
authored
Added a simple frontend (#19)
- added a new module - added a base configuration - added buttons for authorization
1 parent bbb7bd6 commit 13a5b6d

File tree

8 files changed

+3049
-1
lines changed

8 files changed

+3049
-1
lines changed

frontend/build.gradle.kts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import com.saveourtool.template.build.kotlinw
2+
3+
plugins {
4+
kotlin("multiplatform")
5+
}
6+
7+
kotlin {
8+
js {
9+
browser {
10+
commonWebpackConfig {
11+
cssSupport {
12+
enabled = true
13+
}
14+
}
15+
}
16+
binaries.executable()
17+
}
18+
19+
sourceSets {
20+
jsMain {
21+
dependencies {
22+
implementation(project.dependencies.enforcedPlatform(libs.kotlin.wrappers.bom))
23+
implementation(kotlinw("react"))
24+
implementation(kotlinw("react-dom"))
25+
}
26+
}
27+
}
28+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.saveourtool.template.frontend
2+
3+
import react.FC
4+
import react.Props
5+
import react.create
6+
import react.dom.client.createRoot
7+
import react.dom.html.ReactHTML.button
8+
import react.dom.html.ReactHTML.div
9+
import react.dom.html.ReactHTML.h1
10+
import web.dom.document
11+
12+
val App: FC<Props> = FC {
13+
h1 {
14+
+"Authentication page"
15+
}
16+
div {
17+
button {
18+
+"GitHub"
19+
}
20+
button {
21+
+"Google"
22+
}
23+
}
24+
}
25+
26+
fun main() {
27+
val container = document.getElementById("root") ?: error("Couldn't find root container!")
28+
createRoot(container).render(App.create())
29+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>App Cloud template</title>
6+
</head>
7+
<body>
8+
<div id ="root"></div>
9+
<script src="frontend.js"></script>
10+
</body>
11+
</html>

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ org.gradle.vfs.watch=true
66
## there will be a replacement `org.gradle.unsafe.isolated-project`: https://github.com/gradle/gradle/pull/16930
77
#org.gradle.configureondemand=true
88
kotlin.native.cacheKind.linuxX64=static
9+
kotlin.js.compiler=ir
910

1011
# See <https://docs.gradle.com/enterprise/gradle-plugin/>
1112
#

gradle/libs.versions.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[versions]
22
kotlin = "1.9.22"
3+
kotlin-wrappers = "1.0.0-pre.715"
34
kotlin-serialization = "1.6.3"
45
spring-boot = "3.2.3"
56
springdoc = "2.3.0"
@@ -18,4 +19,5 @@ springdoc-openapi-starter-common = { module = "org.springdoc:springdoc-openapi-s
1819
springdoc-openapi-starter-webflux-ui = { module = "org.springdoc:springdoc-openapi-starter-webflux-ui", version.ref = "springdoc" }
1920
springdoc-openapi-starter-webmvc-ui = { module = "org.springdoc:springdoc-openapi-starter-webmvc-ui", version.ref = "springdoc" }
2021

21-
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlin-serialization"}
22+
kotlin-wrappers-bom = { module = "org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom", version.ref = "kotlin-wrappers" }
23+
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlin-serialization"}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package com.saveourtool.template.build
2+
3+
fun kotlinw(target: String): String = "org.jetbrains.kotlin-wrappers:kotlin-$target"

0 commit comments

Comments
 (0)