-
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
yuta-ikeoku
committed
Jun 20, 2024
1 parent
4e91b70
commit e58a36a
Showing
16 changed files
with
362 additions
and
247 deletions.
There are no files selected for viewing
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,40 @@ | ||
import androidx.compose.runtime.* | ||
import components.pages.QuizPage | ||
import components.pages.ResultPage | ||
import components.pages.TopPage | ||
import core.ComposeQuiz | ||
import core.ComposeResult | ||
import core.Quiz | ||
import core.Result | ||
|
||
@Composable | ||
fun App() { | ||
var resultId by remember { mutableStateOf(0) } | ||
var currentPage by remember { mutableStateOf(Page.RESULT) } | ||
val quiz: Quiz by remember { mutableStateOf(ComposeQuiz()) } | ||
val result: Result by remember { mutableStateOf(ComposeResult()) } | ||
|
||
|
||
when (currentPage) { | ||
Page.TOP -> TopPage( | ||
onClickStart = { currentPage = Page.QUIZ } | ||
) | ||
|
||
Page.QUIZ -> QuizPage( | ||
quiz = quiz, | ||
onClickFinish = { nextId: Int -> | ||
resultId = nextId | ||
currentPage = Page.RESULT | ||
} | ||
) | ||
|
||
Page.RESULT -> ResultPage( | ||
diagnosis = result.getDiagnosis(resultId), | ||
onClickBack = { | ||
quiz.reset() | ||
resultId = 0 | ||
currentPage = Page.TOP | ||
} | ||
) | ||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
torisetsu/src/jsMain/kotlin/components/base/ButtonStyle.kt
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,47 @@ | ||
package components.base | ||
|
||
import org.jetbrains.compose.web.css.* | ||
import style.GlobalStyle | ||
import style.data | ||
import style.forMobile | ||
|
||
object ButtonStyle : StyleSheet(GlobalStyle) { | ||
val rootElm by style { | ||
data("size", "normal") { | ||
padding(16.px, 36.px) | ||
borderRadius(16.px) | ||
fontSize(32.px) | ||
} | ||
|
||
|
||
data("size", "large") { | ||
padding(40.px, 100.px) | ||
borderRadius(40.px) | ||
fontSize(60.px) | ||
} | ||
|
||
forMobile { | ||
data("size", "normal") { | ||
padding(16.px, 36.px) | ||
borderRadius(12.px) | ||
fontSize(24.px) | ||
} | ||
|
||
data("size", "large") { | ||
padding(20.px, 50.px) | ||
borderRadius(20.px) | ||
fontSize(32.px) | ||
} | ||
} | ||
|
||
|
||
|
||
backgroundImage("linear-gradient(#5772FF, #0054DD)") | ||
color(Color.white) | ||
fontWeight(700) | ||
property( | ||
"box-shadow", | ||
"0px 5.13px 5.13px 0px #F9F7F340 inset, 0px -5.13px 5.13px 0px #00000040 inset" | ||
) | ||
} | ||
} |
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,24 +1,13 @@ | ||
package components.base | ||
|
||
import androidx.compose.runtime.Composable | ||
import org.jetbrains.compose.web.css.* | ||
import org.jetbrains.compose.web.dom.Div | ||
|
||
@Composable | ||
fun Card( | ||
content: @Composable() () -> Unit | ||
) { | ||
Div( | ||
attrs = { | ||
style { | ||
padding(32.px) | ||
backgroundColor(rgb(255, 255, 255)) | ||
borderRadius(16.px) | ||
property("box-shadow", "0px 4px 4px rgba(0, 0, 0, 0.25), 0px 8px 6px rgba(0, 0, 0, 0.10)") | ||
|
||
} | ||
} | ||
) { | ||
Div(attrs = { classes(CardStyle.rootElm) }) { | ||
content() | ||
} | ||
} |
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,18 @@ | ||
package components.base | ||
|
||
import org.jetbrains.compose.web.css.* | ||
import style.GlobalStyle | ||
import style.forMobile | ||
|
||
object CardStyle : StyleSheet(GlobalStyle) { | ||
val rootElm by style { | ||
padding(32.px) | ||
backgroundColor(rgb(255, 255, 255)) | ||
borderRadius(16.px) | ||
property("box-shadow", "0px 4px 4px rgba(0, 0, 0, 0.25), 0px 8px 6px rgba(0, 0, 0, 0.10)") | ||
|
||
forMobile { | ||
padding(24.px) | ||
} | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
torisetsu/src/jsMain/kotlin/components/base/PageLayoutStyle.kt
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,35 @@ | ||
package components.base | ||
|
||
import org.jetbrains.compose.web.css.* | ||
import style.GlobalStyle | ||
|
||
object PageLayoutStyle : StyleSheet(GlobalStyle) { | ||
val rootElm by style { | ||
padding(32.px, 24.px) | ||
display(DisplayStyle.Flex) | ||
flexDirection(FlexDirection.Column) | ||
alignItems(AlignItems.Center) | ||
} | ||
val wrapper by style { | ||
width(649.px) | ||
maxWidth(100.percent) | ||
display(DisplayStyle.Flex) | ||
alignItems(AlignItems.Center) | ||
flexDirection(FlexDirection.Column) | ||
} | ||
val header by style { | ||
display(DisplayStyle.Flex) | ||
flexDirection(FlexDirection.Row) | ||
gap(60.px) | ||
} | ||
val titleLogo by style { | ||
width(150.px) | ||
} | ||
val m3Logo by style { | ||
width(160.px) | ||
} | ||
val main by style { | ||
marginTop(40.px) | ||
width(100.percent) | ||
} | ||
} |
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
Oops, something went wrong.