-
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.
* Update intro button copy * Make the PrimaryButton bigger * Make the CTA bar smaller * Style the Lesson screen * Add validation for lesson items ids * WIP: Lesson 1 * Improve UI scaling * Improve UI * Auto scroll to last item * Add platform capabilities to play sound * Add support for sound items * Add play icon
- Loading branch information
1 parent
34d89f0
commit d4533c9
Showing
33 changed files
with
290 additions
and
110 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
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
37 changes: 37 additions & 0 deletions
37
composeApp/src/commonMain/kotlin/component/button/SecondaryButton.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,37 @@ | ||
package component.button | ||
|
||
import androidx.compose.foundation.BorderStroke | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.MaterialTheme | ||
import androidx.compose.material.OutlinedButton | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun SecondaryButton( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
icon: ImageVector? = null, | ||
enabled: Boolean = true, | ||
onClick: () -> Unit, | ||
) { | ||
OutlinedButton( | ||
modifier = modifier, | ||
enabled = enabled, | ||
border = BorderStroke(1.dp, MaterialTheme.colors.secondary), | ||
contentPadding = PaddingValues(horizontal = 16.dp, vertical = 8.dp), | ||
onClick = onClick | ||
) { | ||
if (icon != null) { | ||
Icon(imageVector = icon, contentDescription = null) | ||
Spacer(Modifier.width(8.dp)) | ||
} | ||
Text(text = text) | ||
} | ||
} |
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
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
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
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
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
24 changes: 24 additions & 0 deletions
24
composeApp/src/commonMain/kotlin/ui/screen/lesson/composable/item/SoundLessonItem.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,24 @@ | ||
package ui.screen.lesson.composable.item | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.PlayArrow | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import component.button.SecondaryButton | ||
import ui.screen.lesson.SoundItemViewState | ||
|
||
@Composable | ||
fun SoundLessonItem( | ||
viewState: SoundItemViewState, | ||
onClick: (soundUrl: String) -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
SecondaryButton( | ||
modifier = modifier.padding(top = 12.dp), | ||
text = viewState.text, | ||
icon = Icons.Default.PlayArrow, | ||
onClick = { onClick(viewState.soundUrl) }, | ||
) | ||
} |
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
17 changes: 17 additions & 0 deletions
17
composeApp/src/commonMain/kotlin/ui/screen/lesson/handler/OnSoundClickEventHandler.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,17 @@ | ||
package ui.screen.lesson.handler | ||
|
||
import Platform | ||
import ui.EventHandler | ||
import ui.screen.lesson.LessonViewEvent | ||
import ui.screen.lesson.LessonViewModel | ||
import ui.screen.lesson.LessonVmContext | ||
|
||
class OnSoundClickEventHandler( | ||
private val platform: Platform | ||
) : EventHandler<LessonViewEvent.OnSoundClick, LessonViewModel.LocalState> { | ||
override val eventTypes = setOf(LessonViewEvent.OnSoundClick::class) | ||
|
||
override suspend fun LessonVmContext.handleEvent(event: LessonViewEvent.OnSoundClick) { | ||
platform.playSound(soundUrl = event.soundUrl) | ||
} | ||
} |
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
Oops, something went wrong.