Skip to content

Commit

Permalink
Merge pull request #230 from tarkalabs/priya/improvement/TUISelection…
Browse files Browse the repository at this point in the history
…Card

Impovement : TUISelectionCard.kt
  • Loading branch information
rajajawahar authored Apr 29, 2024
2 parents 7d8fa0d + 274c1c4 commit 831388f
Showing 1 changed file with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.testTagsAsResourceId
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.tarkalabs.tarkaui.R
import com.tarkalabs.tarkaui.components.HorizontalSpacer
import com.tarkalabs.tarkaui.components.VerticalSpacer
import com.tarkalabs.tarkaui.components.base.BadgeStyle
Expand All @@ -40,6 +42,7 @@ enum class SecondaryDetailsStyle {
NORMAL,
ERROR
}

/**
* This Composable function is used to Show the Cards in a list to pick the particular from User.
*
Expand All @@ -64,7 +67,7 @@ fun TUISelectionCard(
modifier: Modifier = Modifier,
leadingIcon: TarkaIcon? = null,
label: String? = null,
primaryDescription: String,
primaryDescription: String? = null,
secondaryDescription: String? = null,
primaryDetails: String? = null,
secondaryDetails: String? = null,
Expand Down Expand Up @@ -119,12 +122,21 @@ fun TUISelectionCard(
}


Text(
modifier = Modifier.testTag(tags.descriptionTag),
text = primaryDescription,
color = TUITheme.colors.inputText,
style = TUITheme.typography.heading6
)
if (primaryDescription.isNullOrEmpty()) {
Text(
modifier = Modifier.testTag(tags.descriptionTag),
text = stringResource(id = R.string.not_availble),
color = TUITheme.colors.utilityDisabledContent,
style = TUITheme.typography.heading6
)
} else {
Text(
modifier = Modifier.testTag(tags.descriptionTag),
text = primaryDescription,
color = TUITheme.colors.inputText,
style = TUITheme.typography.heading6
)
}
VerticalSpacer(space = 4)

primaryDetails?.let {
Expand Down Expand Up @@ -225,7 +237,7 @@ fun TUISelectionCardPreview() {
) {
TUISelectionCard(
label = "itemNum",
primaryDescription = "item Description",
primaryDescription = null,
primaryDetails = "location",
secondaryDetails = "- 11 Unit",
secondaryDetailStyle = ERROR,
Expand Down Expand Up @@ -286,7 +298,7 @@ fun TUISelectionCardPreview() {
TUISelectionCard(
leadingIcon = Regular.Person24,
label = "Label",
primaryDescription = "Description",
primaryDescription = null,
secondaryDescription = "Description2",
primaryDetails = "Details",
secondaryDetails = "Details2",
Expand Down

0 comments on commit 831388f

Please sign in to comment.