From aed6d7cd38a846d5eafddb97d8cd4ada259518f3 Mon Sep 17 00:00:00 2001 From: Aslan Date: Sat, 18 May 2024 00:17:14 +0300 Subject: [PATCH] feat: navigate to bento page when credit text is clicked --- .../spiritvisor/cocktail/component/CreditText.kt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/composeApp/src/commonMain/kotlin/com/aslansari/spiritvisor/cocktail/component/CreditText.kt b/composeApp/src/commonMain/kotlin/com/aslansari/spiritvisor/cocktail/component/CreditText.kt index 617e236..00abe9d 100644 --- a/composeApp/src/commonMain/kotlin/com/aslansari/spiritvisor/cocktail/component/CreditText.kt +++ b/composeApp/src/commonMain/kotlin/com/aslansari/spiritvisor/cocktail/component/CreditText.kt @@ -1,5 +1,7 @@ package com.aslansari.spiritvisor.cocktail.component +import androidx.compose.foundation.clickable +import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding @@ -9,9 +11,11 @@ import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.withStyle @@ -31,7 +35,16 @@ fun CreditText(modifier: Modifier = Modifier) { } append(" with") } - Text(creditText, style = MaterialTheme.typography.body2.copy(color = Color(0xFF697077))) + val uriHandler = LocalUriHandler.current + Text( + modifier = Modifier.clickable( + onClick = { uriHandler.openUri("https://bento.me/aslansari") }, + interactionSource = remember { MutableInteractionSource() }, + indication = null, + ) , + text = creditText, + style = MaterialTheme.typography.body2.copy(color = Color(0xFF697077)) + ) Spacer(Modifier.size(2.dp)) Icon( imageVector = Icons.HeartSharp,