From 2f83db10c1009eb1636395e2fd4b5d02a769c8ae Mon Sep 17 00:00:00 2001 From: Karan Sharma <55722391+ksharma-xyz@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:46:16 +1100 Subject: [PATCH] No border when looking at detail as we need more space --- .../trip/planner/ui/components/JourneyCard.kt | 26 ++++++++++++++----- .../planner/ui/timetable/TimeTableScreen.kt | 6 ++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/JourneyCard.kt b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/JourneyCard.kt index 7bebfb4e..68708a18 100644 --- a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/JourneyCard.kt +++ b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/components/JourneyCard.kt @@ -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 @@ -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( @@ -481,7 +493,7 @@ private fun PreviewJourneyCardCollapsed() { ), ), - ), + ), cardState = JourneyCardState.COLLAPSED, onClick = {}, ) diff --git a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/timetable/TimeTableScreen.kt b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/timetable/TimeTableScreen.kt index 85d6bcaa..6b46dc1c 100644 --- a/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/timetable/TimeTableScreen.kt +++ b/feature/trip-planner/ui/src/main/kotlin/xyz/ksharma/krail/trip/planner/ui/timetable/TimeTableScreen.kt @@ -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)) },