mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-13 00:57:06 +05:30
fix(common): simplify favicon display
This commit is contained in:
parent
a2f3faad0f
commit
d36bcd6b26
2 changed files with 7 additions and 19 deletions
|
@ -20,9 +20,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
|
@ -33,7 +31,6 @@ import androidx.compose.runtime.produceState
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
|
@ -115,21 +112,12 @@ fun PostLink(
|
|||
)
|
||||
) {
|
||||
Row(modifier = Modifier.padding(16.dp), horizontalArrangement = Arrangement.spacedBy(16.dp)) {
|
||||
if (linkMetadata.faviconUrl != null) {
|
||||
NetworkImage(
|
||||
url = linkMetadata.faviconUrl!!,
|
||||
placeholder = ClawIcons.Web,
|
||||
contentDescription = "",
|
||||
modifier = Modifier.size(24.dp),
|
||||
)
|
||||
} else {
|
||||
Icon(
|
||||
painter = ClawIcons.Web,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSecondary,
|
||||
modifier = Modifier.clip(CircleShape),
|
||||
)
|
||||
}
|
||||
NetworkImage(
|
||||
url = linkMetadata.faviconUrl,
|
||||
placeholder = ClawIcons.Web,
|
||||
contentDescription = "",
|
||||
modifier = Modifier.size(24.dp),
|
||||
)
|
||||
Text(
|
||||
text = linkMetadata.url,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
|
|
|
@ -13,7 +13,7 @@ import coil.compose.AsyncImage
|
|||
|
||||
@Composable
|
||||
fun NetworkImage(
|
||||
url: String,
|
||||
url: String?,
|
||||
placeholder: Painter,
|
||||
contentDescription: String,
|
||||
modifier: Modifier = Modifier,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue