Skip to content

Commit 47832df

Browse files
Merge pull request #18 from kota-shiokara/develop
v2.2.0
2 parents 5fb15c7 + f92de82 commit 47832df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1240
-430
lines changed

.fleet/receipt.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Project generated by Kotlin Multiplatform Wizard
2+
{
3+
"spec": {
4+
"template_id": "kmt",
5+
"targets": {
6+
"web": {
7+
"ui": [
8+
"compose"
9+
]
10+
}
11+
}
12+
},
13+
"timestamp": "2024-07-07T15:01:46.407950621Z"
14+
}

.github/workflows/deploy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Grant execute permission for gradlew
1818
run: chmod +x gradlew
1919
- name: Build with Gradle
20-
run: ./gradlew wasmJsBrowserWebpack
20+
run: ./gradlew wasmJsBrowserDistribution
2121
- name: deploy
2222
uses: peaceiris/actions-gh-pages@v3
2323
with:

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,6 @@ kotlin-js-store/*
153153
!.idea/scopes
154154

155155
# gradle-wrapper
156-
!gradle/wrapper/gradle-wrapper.jar
156+
!gradle/wrapper/gradle-wrapper.jar
157+
158+
.kotlin

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
keeprun:
2+
./gradlew wasmJsBrowserRun --continuous
3+
4+
run:
5+
./gradlew wasmJsBrowserRun

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# kota-shiokara.github.io
22

33
## Running the Project
4-
```
4+
```shell
5+
# Simple Run
56
./gradlew wasmJsBrowserRun
7+
# or
8+
make run
69
```
710
or
8-
```
11+
```shell
12+
# Active Hot Reload
913
./gradlew wasmJsBrowserRun --continuous
14+
# or
15+
make keeprun
1016
```
1117

1218
## Build the project

build.gradle.kts

Lines changed: 22 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,48 @@
1-
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
1+
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
22

33
group = "jp.ikanoshiokara"
4-
version = "2.1.0"
5-
6-
repositories {
7-
google()
8-
mavenCentral()
9-
mavenLocal()
10-
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
11-
maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
12-
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
13-
}
4+
version = "2.2.0"
145

156
plugins {
16-
kotlin("multiplatform")
17-
id("org.jetbrains.compose")
7+
alias(libs.plugins.kotlin.multiplatform)
8+
alias(libs.plugins.jetbrains.compose)
9+
alias(libs.plugins.compose.compiler)
1810
}
1911

20-
// なんでこれ使ってエラーなるのかわからない
21-
//val copyWasmResources = tasks.create("copyWasmResourcesWorkaround", Copy::class.java) {
22-
// from(rootProject.file("src/wasmJsMain/resources"))
23-
// into("build/processedResources/wasmJs/main")
24-
//}
25-
//
26-
//afterEvaluate {
27-
// project.tasks.getByName("wasmJsProcessResources").finalizedBy(copyWasmResources)
28-
//}
29-
30-
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
3112
kotlin {
13+
@OptIn(ExperimentalWasmDsl::class)
3214
wasmJs {
33-
moduleName = "kota-shiokara.github.io"
34-
3515
browser {
3616
commonWebpackConfig {
3717
outputFileName = "kota-shiokara.github.io.js"
38-
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).apply {
39-
static = (static ?: mutableListOf()).apply {
40-
add(project.rootDir.path)
41-
}
42-
}
4318
}
4419
}
4520
binaries.executable()
4621
}
4722

4823
sourceSets {
49-
val wasmJsMain by getting {
24+
commonMain {
5025
dependencies {
5126
implementation(compose.runtime)
5227
implementation(compose.foundation)
53-
implementation(compose.material)
54-
implementation(compose.ui)
55-
56-
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
28+
implementation(compose.material3)
29+
implementation(compose.materialIconsExtended)
5730
implementation(compose.components.resources)
31+
32+
// Preview
33+
implementation(compose.components.uiToolingPreview)
34+
implementation(libs.composeMaterialWindowSize)
5835
}
5936
}
6037
}
6138
}
6239

63-
compose.experimental {
64-
web.application {}
65-
}
66-
67-
compose {
68-
val kotlinVersion = rootProject.extra["kotlin.version"] as String
69-
val composeCompilerVersion = rootProject.extra["compose.compiler.version"] as String
70-
71-
kotlinCompilerPlugin.set(composeCompilerVersion)
72-
kotlinCompilerPluginArgs.add("suppressKotlinVersionCompatibilityCheck=$kotlinVersion")
73-
}
74-
40+
// なんでこれ使ってエラーなるのかわからない
41+
//val copyWasmResources = tasks.create("copyWasmResourcesWorkaround", Copy::class.java) {
42+
// from(rootProject.file("src/wasmJsMain/resources"))
43+
// into("build/processedResources/wasmJs/main")
44+
//}
45+
//
46+
//afterEvaluate {
47+
// project.tasks.getByName("wasmJsProcessResources").finalizedBy(copyWasmResources)
48+
//}

gradle.properties

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
kotlin.code.style=official
22
org.jetbrains.compose.experimental.jscanvas.enabled=true
3-
org.gradle.jvmargs=-Xmx3g
4-
5-
kotlin.version=1.9.20
6-
compose.compiler.version=1.5.3
7-
compose.wasm.version=1.5.10-dev-wasm03
3+
org.gradle.jvmargs=-Xmx3g

gradle/libs.versions.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[versions]
2+
kotlin = "2.0.0"
3+
compose = "1.6.11"
4+
5+
[libraries]
6+
# JetBrainsのCompose MaterialがWindowSizeClassに対応するまでの暫定
7+
composeMaterialWindowSize = "dev.chrisbanes.material3:material3-window-size-class-multiplatform:0.5.0"
8+
9+
[plugins]
10+
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
11+
jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "compose" }
12+
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

settings.gradle.kts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ pluginManagement {
44
repositories {
55
google()
66
gradlePluginPortal()
7+
mavenCentral()
78
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
8-
maven("https://maven.pkg.jetbrains.space/kotlin/p/wasm/experimental")
9-
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
109
}
10+
}
1111

12-
plugins {
13-
val kotlinVersion = extra["kotlin.version"] as String
14-
val composeVersion = extra["compose.wasm.version"] as String
15-
16-
kotlin("multiplatform").version(kotlinVersion)
17-
id("org.jetbrains.compose").version(composeVersion)
12+
dependencyResolutionManagement {
13+
repositories {
14+
google()
15+
mavenCentral()
16+
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
1817
}
1918
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<resources>
2+
<string name="app_name">kota-shiokara</string>
3+
<string name="section_top_welcome">Welcome to kota-shiokara's portfolio!</string>
4+
<string name="section_about_me_title">About Me</string>
5+
<string name="my_name_japanese">田島 鼓太郎</string>
6+
<string name="my_name_english">TAJIMA Kotaro</string>
7+
<string name="section_footer_copyright">© 2023 kota-shiokara | All Rights Reserved</string>
8+
</resources>

src/commonMain/kotlin/App.kt

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import androidx.compose.foundation.background
2+
import androidx.compose.foundation.layout.*
3+
import androidx.compose.foundation.lazy.LazyColumn
4+
import androidx.compose.material3.CircularProgressIndicator
5+
import androidx.compose.material3.Text
6+
import androidx.compose.runtime.Composable
7+
import androidx.compose.ui.Alignment
8+
import androidx.compose.ui.Modifier
9+
import androidx.compose.ui.graphics.Color
10+
import androidx.compose.ui.graphics.StrokeCap
11+
import androidx.compose.ui.unit.dp
12+
import component.TopPageFooter
13+
import section.AboutMeSection
14+
import section.BlogSection
15+
import section.TopSection
16+
import section.WorkSection
17+
import theme.ShiokaraTheme
18+
import theme.primaryColor
19+
20+
@Composable
21+
fun App() {
22+
ShiokaraTheme {
23+
BoxWithConstraints {
24+
val height = maxHeight
25+
val sectionSpan = 32.dp
26+
27+
LazyColumn(
28+
modifier = Modifier.fillMaxSize(),
29+
) {
30+
item {
31+
TopSection(height = height)
32+
}
33+
34+
item {
35+
Spacer(modifier = Modifier.height(16.dp))
36+
AboutMeSection()
37+
}
38+
39+
item {
40+
Spacer(modifier = Modifier.height(sectionSpan))
41+
WorkSection()
42+
}
43+
44+
item {
45+
Spacer(modifier = Modifier.height(sectionSpan))
46+
BlogSection()
47+
}
48+
49+
item {
50+
TopPageFooter()
51+
}
52+
}
53+
}
54+
}
55+
}
56+
57+
@Composable
58+
fun LoadingCircle() {
59+
Column(
60+
modifier = Modifier
61+
.fillMaxSize()
62+
.background(primaryColor),
63+
verticalArrangement = Arrangement.Center,
64+
horizontalAlignment = Alignment.CenterHorizontally
65+
) {
66+
Text(
67+
text = "Loading...",
68+
color = Color.White
69+
)
70+
Spacer(modifier = Modifier.height(16.dp))
71+
CircularProgressIndicator(
72+
color = Color.White,
73+
strokeWidth = 8.dp,
74+
strokeCap = StrokeCap.Round
75+
)
76+
}
77+
}

src/wasmJsMain/kotlin/component/AsyncImage.kt renamed to src/commonMain/kotlin/component/AsyncImage.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ import androidx.compose.runtime.mutableStateOf
88
import androidx.compose.runtime.remember
99
import androidx.compose.runtime.setValue
1010
import androidx.compose.ui.Modifier
11+
import androidx.compose.ui.graphics.ColorFilter
1112
import androidx.compose.ui.graphics.ImageBitmap
1213
import androidx.compose.ui.layout.ContentScale
13-
import utils.ImageLoader
1414
import utils.Log
15+
import utils.fetchImageBitmap
1516

1617
@Composable
1718
fun AsyncImage(
1819
imageUrl: String,
1920
contentDescription: String?,
2021
modifier: Modifier = Modifier,
21-
contentScale: ContentScale = ContentScale.Crop
22+
contentScale: ContentScale = ContentScale.Crop,
23+
colorFilter: ColorFilter? = null,
2224
) {
2325
var bitmap: ImageBitmap? by remember { mutableStateOf(null) }
2426

@@ -27,12 +29,13 @@ fun AsyncImage(
2729
bitmap!!,
2830
contentDescription = contentDescription,
2931
modifier = modifier,
30-
contentScale = contentScale
32+
contentScale = contentScale,
33+
colorFilter = colorFilter
3134
)
3235
}
3336

3437
LaunchedEffect(imageUrl) {
35-
runCatching { ImageLoader.fetchImageBitmap(imageUrl) }
38+
runCatching { fetchImageBitmap(imageUrl) }
3639
.onSuccess {
3740
bitmap = it
3841
}

src/wasmJsMain/kotlin/component/AvatarImage.kt renamed to src/commonMain/kotlin/component/AvatarImage.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ package component
22

33
import androidx.compose.runtime.Composable
44
import androidx.compose.ui.Modifier
5+
import androidx.compose.ui.graphics.ColorFilter
56

67
@Composable
78
fun AvatarImage(
89
imageUrl: String,
910
contentDescription: String?,
10-
modifier: Modifier = Modifier
11+
modifier: Modifier = Modifier,
12+
colorFilter: ColorFilter? = null,
1113
) {
1214
AsyncImage(
1315
imageUrl = imageUrl,
1416
contentDescription = contentDescription,
15-
modifier = modifier
17+
modifier = modifier,
18+
colorFilter = colorFilter
1619
)
1720
}

0 commit comments

Comments
 (0)