Skip to content

Commit

Permalink
小文字始まりのComposableをトリ除いた
Browse files Browse the repository at this point in the history
  • Loading branch information
vaaaaanquish committed Jun 18, 2024
1 parent a9219e2 commit 34eb5d3
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 24 deletions.
12 changes: 6 additions & 6 deletions torisetsu/src/jsMain/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import components.pages.quizPage
import components.pages.resultPage
import components.pages.topPage
import components.pages.QuizPage
import components.pages.ResultPage
import components.pages.TopPage
import core.ComposeQuiz
import core.ComposeResult
import core.Quiz
Expand All @@ -25,19 +25,19 @@ fun main() {
val result: Result by remember { mutableStateOf(ComposeResult()) }

when (currentPage) {
Page.TOP -> topPage(
Page.TOP -> TopPage(
onClickStart = { currentPage = Page.QUIZ }
)

Page.QUIZ -> quizPage(
Page.QUIZ -> QuizPage(
quiz = quiz,
onClickFinish = { nextId: Int ->
resultId = nextId
currentPage = Page.RESULT
}
)

Page.RESULT -> resultPage(
Page.RESULT -> ResultPage(
diagnosis = result.getDiagnosis(resultId),
onClickBack = {
quiz.reset()
Expand Down
2 changes: 1 addition & 1 deletion torisetsu/src/jsMain/kotlin/components/base/Button.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enum class ButtonSize {
}

@Composable
fun button(
fun Button(
onClick: () -> Unit,
size: ButtonSize,
content: @Composable () -> Unit,
Expand Down
2 changes: 1 addition & 1 deletion torisetsu/src/jsMain/kotlin/components/base/Card.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.jetbrains.compose.web.css.*
import org.jetbrains.compose.web.dom.Div

@Composable
fun card(
fun Card(
content: @Composable() () -> Unit
) {
Div(
Expand Down
2 changes: 1 addition & 1 deletion torisetsu/src/jsMain/kotlin/components/base/PageLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.Img

@Composable
fun pageLayout(
fun PageLayout(
content: @Composable() () -> Unit
) {
return Div(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import org.jetbrains.compose.web.dom.Img
import org.jetbrains.compose.web.dom.Text

@Composable
fun xShareButton() {
fun XShareButton() {
A(
href = "https://twitter.com/intent/tweet?text=私のトリタイプはハシビロコウです!&url=https://example.com&hashtags=トリタイプ診断",
attrs = {
Expand Down
11 changes: 5 additions & 6 deletions torisetsu/src/jsMain/kotlin/components/pages/QuizPage.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
package components.pages

import androidx.compose.runtime.Composable
import androidx.compose.runtime.setValue
import components.base.card
import components.base.pageLayout
import components.base.Card
import components.base.PageLayout
import core.Quiz
import org.jetbrains.compose.web.css.*
import org.jetbrains.compose.web.dom.Button
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.Text

@Composable
fun quizPage(
fun QuizPage(
quiz: Quiz,
onClickFinish: (nextId: Int) -> Unit,
) {
pageLayout {
PageLayout {
Div(
attrs = {
style {
Expand Down Expand Up @@ -69,7 +68,7 @@ fun quizPage(
}
},
) {
card {
Card {
Div(
attrs = {
style {
Expand Down
10 changes: 5 additions & 5 deletions torisetsu/src/jsMain/kotlin/components/pages/ResultPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import org.jetbrains.compose.web.css.*
import org.jetbrains.compose.web.dom.*

@Composable
fun resultPage(diagnosis: Diagnosis, onClickBack: () -> Unit) {
pageLayout {
fun ResultPage(diagnosis: Diagnosis, onClickBack: () -> Unit) {
PageLayout {
Div(
attrs = {
style {
Expand All @@ -23,7 +23,7 @@ fun resultPage(diagnosis: Diagnosis, onClickBack: () -> Unit) {
},
) {
Section {
card {
Card {
Div(
attrs = {
style {
Expand Down Expand Up @@ -93,7 +93,7 @@ fun resultPage(diagnosis: Diagnosis, onClickBack: () -> Unit) {
diagnosis.mainText
)
}
xShareButton()
XShareButton()
}
}
}
Expand Down Expand Up @@ -146,7 +146,7 @@ fun resultPage(diagnosis: Diagnosis, onClickBack: () -> Unit) {
}

}
button(
Button(
onClick = onClickBack,
size = ButtonSize.NORMAL
) {
Expand Down
6 changes: 3 additions & 3 deletions torisetsu/src/jsMain/kotlin/components/pages/TopPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package components.pages

import androidx.compose.runtime.Composable
import components.base.ButtonSize
import components.base.button
import components.base.Button
import org.jetbrains.compose.web.css.*
import org.jetbrains.compose.web.dom.*

@Composable
fun topPage(
fun TopPage(
onClickStart: () -> Unit
) {
Div(
Expand Down Expand Up @@ -84,7 +84,7 @@ fun topPage(
}

) {
button(
Button(
onClick = { onClickStart() },
size = ButtonSize.LARGE
) {
Expand Down

0 comments on commit 34eb5d3

Please sign in to comment.