-
Notifications
You must be signed in to change notification settings - Fork 2
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
898a09e
commit 1746850
Showing
4 changed files
with
94 additions
and
10 deletions.
There are no files selected for viewing
79 changes: 79 additions & 0 deletions
79
core/design-system/src/main/kotlin/xyz/ksharma/krail/design/system/components/Divider.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,79 @@ | ||
package xyz.ksharma.krail.design.system.components | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxHeight | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.CompositionLocalProvider | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.tooling.preview.PreviewLightDark | ||
import androidx.compose.ui.unit.dp | ||
import xyz.ksharma.krail.design.system.LocalContentColor | ||
import xyz.ksharma.krail.design.system.theme.KrailTheme | ||
|
||
@Composable | ||
fun Divider( | ||
modifier: Modifier = Modifier, | ||
type: DividerType = DividerType.HORIZONTAL, | ||
color: Color? = null, | ||
) { | ||
CompositionLocalProvider(LocalContentColor provides KrailTheme.colors.onBackground.copy(alpha = 0.2f)) { | ||
Box( | ||
modifier = modifier | ||
.then( | ||
when (type) { | ||
DividerType.HORIZONTAL -> Modifier | ||
.fillMaxWidth() | ||
.height(1.dp) | ||
|
||
DividerType.VERTICAL -> Modifier | ||
.fillMaxHeight() | ||
.width(1.dp) | ||
} | ||
) | ||
.background(color = color ?: LocalContentColor.current) | ||
) | ||
} | ||
} | ||
|
||
enum class DividerType { | ||
HORIZONTAL, | ||
VERTICAL | ||
} | ||
|
||
@PreviewLightDark | ||
@Composable | ||
private fun DividerPreview() { | ||
KrailTheme { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.height(30.dp) | ||
.background(KrailTheme.colors.background), | ||
contentAlignment = Alignment.Center, | ||
) { | ||
Divider() | ||
} | ||
} | ||
} | ||
|
||
@PreviewLightDark | ||
@Composable | ||
private fun DividerVerticalPreview() { | ||
KrailTheme { | ||
Box( | ||
modifier = Modifier | ||
.size(30.dp) | ||
.background(KrailTheme.colors.background), | ||
contentAlignment = Alignment.Center, | ||
) { | ||
Divider(type = DividerType.VERTICAL) | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...e/src/main/kotlin/xyz/ksharma/krail/trip_planner/ui/state/searchstop/SearchStopUiEvent.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 |
---|---|---|
@@ -1,5 +1,14 @@ | ||
package xyz.ksharma.krail.trip_planner.ui.state.searchstop | ||
|
||
import xyz.ksharma.krail.trip_planner.domain.model.TransportMode | ||
|
||
sealed interface SearchStopUiEvent { | ||
|
||
data class SearchTextChanged(val query: String) : SearchStopUiEvent | ||
|
||
data class StopSelected( | ||
val stopId: String, | ||
val stopName: String, | ||
val mode: List<TransportMode.TransportModeType>, | ||
) : SearchStopUiEvent | ||
} |
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