-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
1 parent
d93b804
commit b9e4f9b
Showing
31 changed files
with
751 additions
and
210 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
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
18 changes: 18 additions & 0 deletions
18
shared/src/commonMain/kotlin/com/mocoding/pokedex/ui/comingsoon/ComingSoonComponent.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,18 @@ | ||
package com.mocoding.pokedex.ui.comingsoon | ||
|
||
import com.arkivanov.decompose.ComponentContext | ||
|
||
class ComingSoonComponent( | ||
componentContext: ComponentContext, | ||
private val output: (Output) -> Unit | ||
): ComponentContext by componentContext { | ||
|
||
fun onOutput(output: Output) { | ||
output(output) | ||
} | ||
|
||
sealed class Output { | ||
object NavigateBack : Output() | ||
} | ||
|
||
} |
75 changes: 75 additions & 0 deletions
75
shared/src/commonMain/kotlin/com/mocoding/pokedex/ui/comingsoon/ComingSoonScreen.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,75 @@ | ||
package com.mocoding.pokedex.ui.comingsoon | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.outlined.Timelapse | ||
import androidx.compose.material.icons.rounded.ArrowBack | ||
import androidx.compose.material3.* | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.dp | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
internal fun ComingSoonScreen(component: ComingSoonComponent) { | ||
|
||
Scaffold( | ||
topBar = { | ||
TopAppBar( | ||
title = {}, | ||
navigationIcon = { | ||
IconButton( | ||
onClick = { | ||
component.onOutput(ComingSoonComponent.Output.NavigateBack) | ||
}, | ||
) { | ||
Icon(Icons.Rounded.ArrowBack, contentDescription = null) | ||
} | ||
}, | ||
colors = TopAppBarDefaults.largeTopAppBarColors( | ||
containerColor = MaterialTheme.colorScheme.background | ||
) | ||
) | ||
} | ||
) { paddingValue -> | ||
Box( | ||
contentAlignment = Alignment.Center, | ||
modifier = Modifier | ||
.padding(paddingValue) | ||
.fillMaxSize() | ||
) { | ||
|
||
Column( | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
modifier = Modifier.padding(horizontal = 20.dp) | ||
) { | ||
Text( | ||
text = "Coming Soon", | ||
color = MaterialTheme.colorScheme.onBackground, | ||
style = MaterialTheme.typography.displayMedium.copy( | ||
fontWeight = FontWeight.Bold | ||
), | ||
) | ||
Spacer(Modifier.height(4.dp)) | ||
Text( | ||
text = "This feature is not implemented yet :D", | ||
color = MaterialTheme.colorScheme.onBackground, | ||
style = MaterialTheme.typography.titleMedium, | ||
) | ||
|
||
Spacer(Modifier.height(20.dp)) | ||
|
||
Image( | ||
Icons.Outlined.Timelapse, | ||
contentDescription = "Coming Soon", | ||
modifier = Modifier.size(100.dp) | ||
) | ||
} | ||
|
||
} | ||
} | ||
|
||
} |
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
41 changes: 41 additions & 0 deletions
41
shared/src/commonMain/kotlin/com/mocoding/pokedex/ui/favorite/FavoriteComponent.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,41 @@ | ||
package com.mocoding.pokedex.ui.favorite | ||
|
||
import com.arkivanov.decompose.ComponentContext | ||
import com.arkivanov.mvikotlin.core.instancekeeper.getStore | ||
import com.arkivanov.mvikotlin.core.store.StoreFactory | ||
import com.arkivanov.mvikotlin.extensions.coroutines.stateFlow | ||
import com.mocoding.pokedex.ui.favorite.store.FavoriteStore | ||
import com.mocoding.pokedex.ui.favorite.store.FavoriteStoreFactory | ||
import kotlinx.coroutines.ExperimentalCoroutinesApi | ||
import kotlinx.coroutines.flow.StateFlow | ||
|
||
class FavoriteComponent( | ||
componentContext: ComponentContext, | ||
storeFactory: StoreFactory, | ||
private val output: (Output) -> Unit | ||
): ComponentContext by componentContext { | ||
|
||
private val favoriteStore = | ||
instanceKeeper.getStore { | ||
FavoriteStoreFactory( | ||
storeFactory = storeFactory, | ||
).create() | ||
} | ||
|
||
@OptIn(ExperimentalCoroutinesApi::class) | ||
val state: StateFlow<FavoriteStore.State> = favoriteStore.stateFlow | ||
|
||
fun onEvent(event: FavoriteStore.Intent) { | ||
favoriteStore.accept(event) | ||
} | ||
|
||
fun onOutput(output: Output) { | ||
output(output) | ||
} | ||
|
||
sealed class Output { | ||
object NavigateBack : Output() | ||
data class NavigateToDetails(val name: String) : Output() | ||
} | ||
|
||
} |
17 changes: 17 additions & 0 deletions
17
shared/src/commonMain/kotlin/com/mocoding/pokedex/ui/favorite/FavoriteScreen.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 com.mocoding.pokedex.ui.favorite | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.collectAsState | ||
import androidx.compose.runtime.getValue | ||
import com.mocoding.pokedex.ui.favorite.components.FavoriteContent | ||
|
||
@Composable | ||
internal fun FavoriteScreen(favoriteComponent: FavoriteComponent) { | ||
val state by favoriteComponent.state.collectAsState() | ||
|
||
FavoriteContent( | ||
state = state, | ||
onEvent = favoriteComponent::onEvent, | ||
onOutput = favoriteComponent::onOutput | ||
) | ||
} |
Oops, something went wrong.