Skip to content

Commit

Permalink
No border when looking at detail as we need more space
Browse files Browse the repository at this point in the history
  • Loading branch information
ksharma-xyz committed Oct 26, 2024
1 parent 068fbce commit 2f83db1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -88,13 +89,24 @@ fun JourneyCard(
.fillMaxWidth()
.clip(RoundedCornerShape(12.dp))
.background(color = KrailTheme.colors.surface)
.border(
width = 2.dp,
shape = RoundedCornerShape(12.dp),
brush = Brush.linearGradient(colors = borderColors),
.then(
if (cardState == JourneyCardState.DEFAULT) Modifier.border(
width = 2.dp,
shape = RoundedCornerShape(12.dp),
brush = Brush.linearGradient(colors = borderColors),
)
else Modifier
)
.clickable(
role = Role.Button,
onClick = onClick,
interactionSource = remember { MutableInteractionSource() },
indication = null,
)
.clickable(role = Role.Button, onClick = onClick)
.padding(vertical = 8.dp, horizontal = 12.dp),
.padding(
vertical = 8.dp,
horizontal = if (cardState == JourneyCardState.DEFAULT) 12.dp else 0.dp
),
) {
when (cardState) {
JourneyCardState.DEFAULT -> DefaultJourneyCardContent(
Expand Down Expand Up @@ -481,7 +493,7 @@ private fun PreviewJourneyCardCollapsed() {
),
),

),
),
cardState = JourneyCardState.COLLAPSED,
onClick = {},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,8 @@ fun TimeTableScreen(
}.toImmutableList(),
legList = journey.legs.toImmutableList(),
cardState = if (expandedJourneyId == journey.journeyId) {
JourneyCardState.EXPANDED
} else {
JourneyCardState.DEFAULT
},
JourneyCardState.COLLAPSED
} else JourneyCardState.DEFAULT,
onClick = {
onEvent(TimeTableUiEvent.JourneyCardClicked(journey.journeyId))
},
Expand Down

0 comments on commit 2f83db1

Please sign in to comment.