Skip to content

Commit

Permalink
fix(ui): Prevent text from being cut off in banner (#757)
Browse files Browse the repository at this point in the history
* remove fixed height for banner and adjust padding to compensate

* rework displayText
  • Loading branch information
aualbert committed Jun 19, 2024
1 parent 384684e commit 0153d7f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/me/ash/reader/ui/component/base/Banner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fun Banner(
Surface(
modifier = modifier
.fillMaxWidth()
.height(if (!desc.isNullOrBlank()) 88.dp else Dp.Unspecified),
.height(Dp.Unspecified),
color = Color.Unspecified,
) {
Row(
Expand All @@ -57,7 +57,7 @@ fun Banner(
view.playSoundEffect(SoundEffectConstants.CLICK)
onClick()
}
.padding(16.dp, 20.dp),
.padding(16.dp, 15.dp),
verticalAlignment = Alignment.CenterVertically
) {
icon?.let { icon ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.ash.reader.ui.component.base

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand All @@ -16,6 +17,7 @@ fun DisplayText(
modifier: Modifier = Modifier,
text: String,
desc: String,
onTextClick: () -> Unit = {},
) {
Column(
modifier = modifier
Expand All @@ -28,9 +30,7 @@ fun DisplayText(
)
) {
Text(
// modifier = Modifier
// .height(44.dp),
// .animateContentSize(tween()),
modifier = Modifier.clickable { onTextClick() },
text = text,
style = MaterialTheme.typography.displaySmall,
color = MaterialTheme.colorScheme.onSurface,
Expand All @@ -39,7 +39,6 @@ fun DisplayText(
)
RYExtensibleVisibility(visible = desc.isNotEmpty()) {
Text(
modifier = Modifier.height(16.dp),
text = desc,
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.outline.copy(alpha = 0.7f),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,9 @@ fun FeedsPage(
) {
item {
DisplayText(
modifier = Modifier.clickable {
accountTabVisible = true
},
text = feedsUiState.account?.name ?: "",
desc = if (isSyncing) stringResource(R.string.syncing) else "",
)
) { accountTabVisible = true }
}
item {
Banner(
Expand Down

0 comments on commit 0153d7f

Please sign in to comment.