Hide Author's website when it isn't available

This commit is contained in:
Saul Henriquez 2022-07-09 12:08:30 -05:00
parent 1750020e20
commit 8c88b8e6da

View File

@ -17,6 +17,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@ -58,13 +59,15 @@ fun LinkItem(
maxLines = 1, maxLines = 1,
style = MaterialTheme.typography.titleMedium style = MaterialTheme.typography.titleMedium
) )
Text( if(linkType.link!=null){
text = linkType.link.toString(), Text(
style = MaterialTheme.typography.bodySmall, text = linkType.link.toString(),
overflow = TextOverflow.Ellipsis, style = MaterialTheme.typography.bodySmall,
maxLines = 2, overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.onSurfaceVariant maxLines = 2,
) color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
} }
} }
} }
@ -74,7 +77,10 @@ fun LinkItem(
fun LinkItemPreview() { fun LinkItemPreview() {
AppTheme(blackTheme = false) { AppTheme(blackTheme = false) {
LinkItem( LinkItem(
linkType = LinkType(R.drawable.ic_email, "R.string.author_email") linkType = LinkType(
R.drawable.ic_email,
stringResource(id = R.string.author_email),
Uri.parse("neostore@neoapps.com"))
) )
} }
} }