@OptIn( ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class, ) @Composable private fun RecentBookmarkItem( bookmark: RecentBookmark, menuItems: List<RecentBookmarksMenuItem>, backgroundColor: Color, onRecentBookmarkClick: (RecentBookmark) -> Unit = {}, ) { var isMenuExpanded by remember { mutableStateOf(false) } Card( modifier = Modifier .width(158.dp) .combinedClickable( enabled = true, onClick = { onRecentBookmarkClick(bookmark) }, onLongClick = { isMenuExpanded = true }, ), shape = cardShape, backgroundColor = backgroundColor, elevation = 6.dp, ) { Column( modifier = Modifier .fillMaxWidth() .padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 8.dp), ) { RecentBookmarkImage(bookmark) Spacer(modifier = Modifier.height(8.dp)) Text( text = bookmark.title ?: bookmark.url ?: "", modifier = Modifier.semantics { testTagsAsResourceId = true testTag = "recent.bookmark.title" }, color = FirefoxTheme.colors.textPrimary, overflow = TextOverflow.Ellipsis, maxLines = 1, style = FirefoxTheme.typography.caption, ) RecentBookmarksMenu( showMenu = isMenuExpanded, menuItems = menuItems, recentBookmark = bookmark, onDismissRequest = { isMenuExpanded = false }, ) } } }
A recent bookmark item.