Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing impressions icon #12644

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.appendInlineContent
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.Divider
import androidx.compose.material.ExperimentalMaterialApi
Expand Down Expand Up @@ -42,9 +44,13 @@ import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.Placeholder
import androidx.compose.ui.text.PlaceholderVerticalAlign
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.woocommerce.android.R
import com.woocommerce.android.R.color
import com.woocommerce.android.R.dimen
Expand Down Expand Up @@ -248,19 +254,39 @@ private fun CampaignImpressionsRow(
modifier: Modifier = Modifier
) {
Column(modifier = modifier) {
Row(modifier = Modifier.fillMaxWidth()) {
Row(
modifier = Modifier
.fillMaxWidth()
.clickable { onImpressionsInfoTapped() }
.padding(top = 8.dp, bottom = 8.dp, end = 8.dp),
verticalAlignment = Alignment.CenterVertically,
) {
val id = "inlineIcon"
val text = buildAnnotatedString {
append(stringResource(id = R.string.blaze_campaign_budget_reach_forecast))
appendInlineContent(id = id, alternateText = "[Icon]")
}
val inlineContent = mapOf(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up inlining the info icon to ensure it looks nice when the text is 2 lines.

id to InlineTextContent(
Placeholder(
width = 24.sp,
height = 20.sp,
placeholderVerticalAlign = PlaceholderVerticalAlign.TextCenter
)
) {
Icon(
modifier = Modifier.padding(start = 4.dp),
painter = painterResource(id = drawable.ic_info_outline_20dp),
contentDescription = ""
)
}
)
Text(
text = stringResource(id = R.string.blaze_campaign_budget_reach_forecast),
text = text,
inlineContent = inlineContent,
style = MaterialTheme.typography.body1,
color = colorResource(id = color.color_on_surface_medium)
)
Icon(
modifier = Modifier
.padding(start = 4.dp)
.clickable { onImpressionsInfoTapped() },
painter = painterResource(id = drawable.ic_info_outline_20dp),
contentDescription = null
)
}
if (state.forecast.isLoading) {
SkeletonView(
Expand Down
Loading