-
Notifications
You must be signed in to change notification settings - Fork 136
Issue/12894 blaze cta text input #12899
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
Changes from 10 commits
0c379e6
5041aa7
022e01b
60cac22
8162173
c29b0d9
b231f77
49c711c
fd75281
66f5b1b
2252ef0
41112ea
3480f07
0778bf4
1f9d78f
7a9af96
df71f0f
f1670b2
819562f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,7 +71,8 @@ fun BlazeCampaignCreationPreviewScreen(viewModel: BlazeCampaignCreationEditAdVie | |
| onMediaPickerDialogDismissed = viewModel::onMediaPickerDialogDismissed, | ||
| onProductImagesRequested = viewModel::onProductImagesRequested, | ||
| onMediaLibraryRequested = viewModel::onMediaLibraryRequested, | ||
| onSaveTapped = viewModel::onSaveTapped | ||
| onSaveTapped = viewModel::onSaveTapped, | ||
| onCtaTextChanged = viewModel::onCtaTextChanged | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -88,7 +89,8 @@ private fun BlazeCampaignCreationEditAdScreen( | |
| onMediaPickerDialogDismissed: () -> Unit, | ||
| onProductImagesRequested: () -> Unit, | ||
| onMediaLibraryRequested: (DataSource) -> Unit, | ||
| onSaveTapped: () -> Unit | ||
| onSaveTapped: () -> Unit, | ||
| onCtaTextChanged: (String) -> Unit | ||
| ) { | ||
| if (viewState.isMediaPickerDialogVisible) { | ||
| MediaPickerDialog( | ||
|
|
@@ -123,7 +125,8 @@ private fun BlazeCampaignCreationEditAdScreen( | |
| onDescriptionChanged, | ||
| onChangeImageTapped, | ||
| onPreviousSuggestionTapped, | ||
| onNextSuggestionTapped | ||
| onNextSuggestionTapped, | ||
| onCtaTextChanged | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -137,6 +140,7 @@ fun CampaignEditAdContent( | |
| onChangeImageTapped: () -> Unit, | ||
| onPreviousSuggestionTapped: () -> Unit, | ||
| onNextSuggestionTapped: () -> Unit, | ||
| onCtaTextChanged: (String) -> Unit | ||
| ) { | ||
| Column( | ||
| modifier = Modifier | ||
|
|
@@ -156,7 +160,8 @@ fun CampaignEditAdContent( | |
| onTagLineChanged = onTagLineChanged, | ||
| onDescriptionChanged = onDescriptionChanged, | ||
| onPreviousSuggestionTapped = onPreviousSuggestionTapped, | ||
| onNextSuggestionTapped = onNextSuggestionTapped | ||
| onNextSuggestionTapped = onNextSuggestionTapped, | ||
| onCtaTextChanged = onCtaTextChanged | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -167,70 +172,25 @@ private fun AdDataSection( | |
| onTagLineChanged: (String) -> Unit, | ||
| onDescriptionChanged: (String) -> Unit, | ||
| onPreviousSuggestionTapped: () -> Unit, | ||
| onNextSuggestionTapped: () -> Unit | ||
| onNextSuggestionTapped: () -> Unit, | ||
| onCtaTextChanged: (String) -> Unit | ||
| ) { | ||
| Column( | ||
| modifier = Modifier | ||
| .padding(dimensionResource(id = dimen.major_100)) | ||
| .fillMaxWidth(), | ||
| horizontalAlignment = Alignment.CenterHorizontally | ||
| ) { | ||
| Box { | ||
| WCOutlinedTextField( | ||
| value = viewState.tagLine, | ||
| onValueChange = onTagLineChanged, | ||
| label = stringResource(id = string.blaze_campaign_edit_ad_change_tagline_title), | ||
| singleLine = true, | ||
| keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next) | ||
| ) | ||
|
|
||
| CornerCharacterWarning( | ||
| charsLeft = viewState.taglineCharactersRemaining, | ||
| modifier = Modifier.align(Alignment.TopEnd) | ||
| ) | ||
| } | ||
|
|
||
| Text( | ||
| text = stringResource( | ||
| id = string.blaze_campaign_edit_ad_characters_remaining, | ||
| viewState.taglineCharactersRemaining | ||
| ), | ||
| style = MaterialTheme.typography.caption, | ||
| color = colorResource(id = color.color_on_surface_disabled), | ||
| modifier = Modifier | ||
| .padding(top = dimensionResource(id = dimen.minor_100)) | ||
| .fillMaxWidth() | ||
| TaglineInputText(viewState, onTagLineChanged) | ||
| DescriptionInputText( | ||
| viewState, | ||
| onDescriptionChanged, | ||
| modifier = Modifier.padding(top = dimensionResource(id = dimen.major_150)) | ||
| ) | ||
|
|
||
| Box( | ||
| modifier = Modifier | ||
| .padding(top = dimensionResource(id = dimen.major_150)) | ||
| ) { | ||
| WCOutlinedTextField( | ||
| value = viewState.description, | ||
| onValueChange = onDescriptionChanged, | ||
| label = stringResource(id = string.blaze_campaign_edit_ad_change_description_title), | ||
| maxLines = 3, | ||
| minLines = 3, | ||
| keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next) | ||
| ) | ||
|
|
||
| CornerCharacterWarning( | ||
| charsLeft = viewState.descriptionCharactersRemaining, | ||
| modifier = Modifier.align(Alignment.TopEnd) | ||
| ) | ||
| } | ||
|
|
||
| Text( | ||
| text = stringResource( | ||
| id = string.blaze_campaign_edit_ad_characters_remaining, | ||
| viewState.descriptionCharactersRemaining | ||
| ), | ||
| style = MaterialTheme.typography.caption, | ||
| color = colorResource(id = color.color_on_surface_disabled), | ||
| modifier = Modifier | ||
| .padding(top = dimensionResource(id = dimen.minor_100)) | ||
| .fillMaxWidth() | ||
| CallToActionInputText( | ||
| viewState, | ||
| onCtaTextChanged, | ||
| modifier = Modifier.padding(top = dimensionResource(id = dimen.major_150)) | ||
| ) | ||
|
|
||
| if (viewState.suggestions.size > 1) { | ||
|
|
@@ -271,6 +231,109 @@ private fun AdDataSection( | |
| } | ||
| } | ||
|
|
||
| @Composable | ||
| private fun DescriptionInputText( | ||
| viewState: ViewState, | ||
| onDescriptionChanged: (String) -> Unit, | ||
| modifier: Modifier = Modifier | ||
| ) { | ||
| Box(modifier = modifier) { | ||
| WCOutlinedTextField( | ||
| value = viewState.description, | ||
| onValueChange = onDescriptionChanged, | ||
| label = stringResource(id = string.blaze_campaign_edit_ad_change_description_title), | ||
| maxLines = 3, | ||
| minLines = 3, | ||
| keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next) | ||
| ) | ||
|
|
||
| CornerCharacterWarning( | ||
| charsLeft = viewState.descriptionCharactersRemaining, | ||
| modifier = Modifier.align(Alignment.TopEnd) | ||
| ) | ||
| } | ||
|
|
||
| Text( | ||
| text = stringResource( | ||
| id = string.blaze_campaign_edit_ad_characters_remaining, | ||
| viewState.descriptionCharactersRemaining | ||
| ), | ||
| style = MaterialTheme.typography.caption, | ||
| color = colorResource(id = color.color_on_surface_disabled), | ||
| modifier = Modifier | ||
| .padding(top = dimensionResource(id = dimen.minor_100)) | ||
| .fillMaxWidth() | ||
| ) | ||
|
||
| } | ||
|
|
||
| @Composable | ||
| private fun TaglineInputText( | ||
| viewState: ViewState, | ||
| onTagLineChanged: (String) -> Unit, | ||
| modifier: Modifier = Modifier | ||
| ) { | ||
| Box(modifier = modifier) { | ||
| WCOutlinedTextField( | ||
| value = viewState.tagLine, | ||
| onValueChange = onTagLineChanged, | ||
| label = stringResource(id = string.blaze_campaign_edit_ad_change_tagline_title), | ||
| singleLine = true, | ||
| keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next) | ||
| ) | ||
|
|
||
| CornerCharacterWarning( | ||
| charsLeft = viewState.taglineCharactersRemaining, | ||
| modifier = Modifier.align(Alignment.TopEnd) | ||
| ) | ||
| } | ||
|
|
||
| Text( | ||
| text = stringResource( | ||
| id = string.blaze_campaign_edit_ad_characters_remaining, | ||
| viewState.taglineCharactersRemaining | ||
| ), | ||
| style = MaterialTheme.typography.caption, | ||
| color = colorResource(id = color.color_on_surface_disabled), | ||
| modifier = Modifier | ||
| .padding(top = dimensionResource(id = dimen.minor_100)) | ||
| .fillMaxWidth() | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| private fun CallToActionInputText( | ||
| viewState: ViewState, | ||
| onCtaTextChanged: (String) -> Unit, | ||
| modifier: Modifier = Modifier | ||
| ) { | ||
| Box(modifier = modifier) { | ||
| WCOutlinedTextField( | ||
| value = viewState.ctaText, | ||
| onValueChange = onCtaTextChanged, | ||
| label = stringResource(id = string.blaze_campaign_edit_ad_change_cta_text_title), | ||
| singleLine = true, | ||
| keyboardOptions = KeyboardOptions(imeAction = ImeAction.Next) | ||
| ) | ||
|
|
||
| CornerCharacterWarning( | ||
| charsLeft = viewState.ctaTextCharactersRemaining, | ||
| modifier = Modifier.align(Alignment.TopEnd) | ||
| ) | ||
| } | ||
|
|
||
| Text( | ||
| text = stringResource( | ||
| id = string.blaze_campaign_edit_ad_characters_remaining, | ||
| viewState.ctaTextCharactersRemaining | ||
| ), | ||
| style = MaterialTheme.typography.caption, | ||
| color = colorResource(id = color.color_on_surface_disabled), | ||
| modifier = Modifier | ||
| .padding(top = dimensionResource(id = dimen.minor_100)) | ||
| .fillMaxWidth() | ||
| ) | ||
| } | ||
|
|
||
| @Composable | ||
| private fun CornerCharacterWarning(charsLeft: Int, modifier: Modifier = Modifier) { | ||
| if (charsLeft < 10) { | ||
|
|
@@ -380,7 +443,8 @@ fun PreviewCampaignEditAdContent() { | |
| onDescriptionChanged = { }, | ||
| onChangeImageTapped = { }, | ||
| onPreviousSuggestionTapped = { }, | ||
| onNextSuggestionTapped = { } | ||
| onNextSuggestionTapped = { }, | ||
| onCtaTextChanged = { }, | ||
| ) | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.