Skip to content

Commit

Permalink
#10 - Click labels
Browse files Browse the repository at this point in the history
  • Loading branch information
jhg3410 committed Feb 26, 2023
1 parent 9f1e1b8 commit 1f41c72
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -42,7 +44,9 @@ import com.example.jetnews.ui.theme.JetnewsTheme
fun PostCardHistory(post: Post, navigateToArticle: (String) -> Unit) {
var openDialog by remember { mutableStateOf(false) }
Row(
Modifier.clickable { navigateToArticle(post.id) }
Modifier.clickable(
onClickLabel = stringResource(id = R.string.action_read_article)
) { navigateToArticle(post.id) }
) {
Image(
painter = painterResource(post.imageThumbId),
Expand Down Expand Up @@ -118,9 +122,12 @@ fun PostCardPopular(
navigateToArticle: (String) -> Unit,
modifier: Modifier = Modifier
) {
val readArticleLabel = stringResource(id = R.string.action_read_article)
Card(
shape = MaterialTheme.shapes.medium,
modifier = modifier.size(280.dp, 240.dp),
modifier = modifier
.size(280.dp, 240.dp)
.semantics { onClick(label = readArticleLabel, action = null) },
onClick = { navigateToArticle(post.id) }
) {
Column {
Expand Down

0 comments on commit 1f41c72

Please sign in to comment.