Skip to content

Commit

Permalink
Use TransportModeInfo (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharma-xyz authored Oct 2, 2024
1 parent dd06968 commit 0b59243
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package xyz.ksharma.krail.design.system.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import xyz.ksharma.krail.design.system.hexToComposeColor
import xyz.ksharma.krail.design.system.model.TransportModeLine
import xyz.ksharma.krail.design.system.model.TransportModeType.Bus
import xyz.ksharma.krail.design.system.model.TransportModeType.Train
import xyz.ksharma.krail.design.system.preview.ComponentPreviews
Expand Down Expand Up @@ -66,12 +66,7 @@ private fun JourneyCardTrainPreview() {
)
},
transportModeIconRow = {
TransportModeIcon(transportModeType = Train)
TransportModeBadge(
backgroundColor = Color.Blue.copy(alpha = 0.8f),
badgeText = "T4",
modifier = Modifier.padding(start = 8.dp)
)
TransportModeInfo(transportModeLine = TransportModeLine(Train, "T4", "#005aa3"))
},
)
}
Expand All @@ -98,28 +93,13 @@ private fun JourneyCardMultipleModesPreview() {
)
},
transportModeIconRow = {
Row(verticalAlignment = Alignment.CenterVertically) {

TransportModeIcon(transportModeType = Train)
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {

TransportModeBadge(
backgroundColor = Color.Blue.copy(alpha = 0.8f),
badgeText = "T4",
modifier = Modifier.padding(horizontal = 8.dp),
)
TransportModeInfo(transportModeLine = TransportModeLine(Train, "T4", "#005aa3"))

SeparatorIcon()

TransportModeIcon(
transportModeType = Bus,
modifier = Modifier.padding(horizontal = 8.dp)
)

TransportModeBadge(
backgroundColor = Bus.hexColorCode.hexToComposeColor(),
badgeText = "700",
modifier = Modifier.padding(end = 8.dp)
)
TransportModeInfo(transportModeLine = TransportModeLine(Bus, "700", "#00B5EF"))
}
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,7 @@ fun JourneyDetailCard(
modifier = Modifier,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
TransportModeIcon(
transportModeType = leg.transportLine.transportModeType,
)

TransportModeBadge(
backgroundColor = leg.transportLine.lineHexColorCode.hexToComposeColor(),
badgeText = leg.transportLine.lineName,
)
TransportModeInfo(transportModeLine = leg.transportLine)
}

// TODO - Flow to next line instead of same Row for large font size/Measure.
Expand Down

0 comments on commit 0b59243

Please sign in to comment.