fun PageTitle()

in ui-components/src/commonMain/kotlin/org/jetbrains/kotlinconf/ui/components/PageTitle.kt [92:184]


fun PageTitle(
    time: String,
    title: String,
    tags: Set<String>,
    lightning: Boolean,
    bookmarked: Boolean,
    onBookmark: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
) {
    Column(
        verticalArrangement = Arrangement.spacedBy(12.dp),
        modifier = modifier.semantics(mergeDescendants = true) {},
    ) {
        Row(
            horizontalArrangement = Arrangement.spacedBy(4.dp),
            verticalAlignment = Alignment.CenterVertically,
        ) {
            if (lightning) {
                Icon(
                    modifier = Modifier.size(16.dp),
                    painter = painterResource(UiRes.drawable.lightning_16_fill),
                    contentDescription = null,
                    tint = KotlinConfTheme.colors.orangeText,
                )
            }

            Text(
                text = time,
                style = KotlinConfTheme.typography.h3,
                color = KotlinConfTheme.colors.primaryText
            )

            Spacer(Modifier.weight(1f))

            val iconTint by animateColorAsState(
                if (bookmarked) KotlinConfTheme.colors.orangeText
                else KotlinConfTheme.colors.primaryText
            )
            Icon(
                modifier = Modifier
                    .size(24.dp)
                    .wrapContentSize(unbounded = true)
                    .toggleable(
                        value = bookmarked,
                        onValueChange = { onBookmark(it) },
                        role = Role.Checkbox,
                        indication = null,
                        interactionSource = null,
                    )
                    .padding(12.dp),
                painter = painterResource(
                    if (bookmarked) UiRes.drawable.bookmark_24_fill else UiRes.drawable.bookmark_24
                ),
                contentDescription = stringResource(UiRes.string.action_bookmark),
                tint = iconTint,
            )
        }
        val isCodelab = "Codelab" in tags
        val isEducation = "Education" in tags
        val hasIcon = isCodelab || isEducation

        Text(
            text = if (hasIcon) {
                buildAnnotatedString {
                    appendInlineContent(
                        id = iconId,
                        alternateText = when {
                            isEducation -> eduPlaceholder
                            isCodelab -> codelabPlaceholder
                            else -> codelabPlaceholder // Should never happen
                        },
                    )
                    append(title)
                }
            } else {
                AnnotatedString(title)
            },
            style = KotlinConfTheme.typography.h1,
            color = KotlinConfTheme.colors.primaryText,
            selectable = true,
            inlineContent = if (hasIcon) pageTitleInlineContent() else emptyMap(),
            modifier = Modifier.semantics { heading() }
        )
        FlowRow(
            horizontalArrangement = Arrangement.spacedBy(4.dp),
            verticalArrangement = Arrangement.spacedBy(4.dp),
        ) {
            tags.forEach { tag ->
                CardTag(label = tag, selected = false)
            }
        }
    }
}