-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Use a FlowRow to display a list of emails instead of a single o…
…ne in UploadSuccessEmail screen
- Loading branch information
1 parent
fec6e07
commit 83bbff1
Showing
3 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,16 @@ import androidx.compose.material3.SuggestionChipDefaults | |
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import com.infomaniak.swisstransfer.ui.theme.CustomShapes | ||
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme | ||
|
||
@Composable | ||
fun EmailAddressChip(text: String) { | ||
fun EmailAddressChip( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
) { | ||
SuggestionChip( | ||
onClick = { }, | ||
label = { | ||
|
@@ -37,6 +41,7 @@ fun EmailAddressChip(text: String) { | |
style = SwissTransferTheme.typography.bodyRegular, | ||
) | ||
}, | ||
modifier = modifier, | ||
enabled = false, | ||
shape = CustomShapes.ROUNDED, | ||
colors = SuggestionChipDefaults.suggestionChipColors( | ||
|
@@ -53,7 +58,7 @@ fun EmailAddressChip(text: String) { | |
private fun EmailAddressChipPreview() { | ||
SwissTransferTheme { | ||
Surface { | ||
EmailAddressChip("[email protected]") | ||
EmailAddressChip(text = "[email protected]") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,8 +32,26 @@ import com.infomaniak.swisstransfer.ui.theme.Margin | |
import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme | ||
import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows | ||
|
||
// TODO: Use correct emails instead of hard-coded values | ||
@Composable | ||
fun UploadSuccessEmailScreen(email: String) { | ||
fun UploadSuccessEmailScreen( | ||
emails: List<String> = listOf( | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"email@[123.123.123.123]", | ||
"\"email\"@example.com", | ||
"[email protected]", | ||
"[email protected]", | ||
"_______@example.com", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]", | ||
), | ||
) { | ||
BottomStickyButtonScaffold( | ||
topBar = { BrandTopAppBar() }, | ||
bottomButton = { | ||
|
@@ -43,12 +61,13 @@ fun UploadSuccessEmailScreen(email: String) { | |
onClick = { /* TODO */ }, | ||
) | ||
}, | ||
content = { Content(email) }, | ||
content = { Content(emails) }, | ||
) | ||
} | ||
|
||
@OptIn(ExperimentalLayoutApi::class) | ||
@Composable | ||
private fun Content(email: String) { | ||
private fun Content(emails: List<String>) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
|
@@ -64,9 +83,17 @@ private fun Content(email: String) { | |
modifier = Modifier.padding(horizontal = Margin.Medium), | ||
) | ||
|
||
Spacer(Modifier.height(Margin.Small)) | ||
|
||
EmailAddressChip(text = email) | ||
FlowRow( | ||
modifier = Modifier.padding(Margin.Medium), | ||
horizontalArrangement = Arrangement.Center, | ||
) { | ||
emails.forEach { | ||
EmailAddressChip( | ||
text = it, | ||
modifier = Modifier.padding(horizontal = Margin.XSmall) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
@@ -75,7 +102,7 @@ private fun Content(email: String) { | |
private fun UploadSuccessEmailScreenPreview() { | ||
SwissTransferTheme { | ||
Surface { | ||
UploadSuccessEmailScreen("[email protected]") | ||
UploadSuccessEmailScreen() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ import com.infomaniak.swisstransfer.ui.utils.PreviewAllWindows | |
@Composable | ||
fun UploadSuccessScreen(transferType: TransferType) { | ||
if (transferType == TransferType.MAIL) { | ||
UploadSuccessEmailScreen(email = "[email protected]") // TODO: Use correct email instead of hard-coded value | ||
UploadSuccessEmailScreen() | ||
} else { | ||
UploadSuccessQrScreen(transferType) | ||
} | ||
|