-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c490c43
commit 3a94af6
Showing
9 changed files
with
125 additions
and
15 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="12dp" | ||
android:height="12dp" | ||
android:viewportWidth="12" | ||
android:viewportHeight="12"> | ||
<path | ||
android:pathData="M6.75,6C6.75,5.586 6.414,5.25 6,5.25H4.125C3.711,5.25 3.375,5.586 3.375,6C3.375,6.414 3.711,6.75 4.125,6.75H5.25V9.75C5.25,10.164 5.586,10.5 6,10.5C6.414,10.5 6.75,10.164 6.75,9.75V6ZM3,0H9C10.657,0 12,1.343 12,3V9C12,10.657 10.657,12 9,12H3C1.343,12 0,10.657 0,9V3C0,1.343 1.343,0 3,0ZM6,4.125C6.621,4.125 7.125,3.621 7.125,3C7.125,2.379 6.621,1.875 6,1.875C5.379,1.875 4.875,2.379 4.875,3C4.875,3.621 5.379,4.125 6,4.125Z" | ||
android:fillColor="#000000" | ||
android:fillType="evenOdd"/> | ||
</vector> |
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
99 changes: 99 additions & 0 deletions
99
...ons/src/main/java/com/stripe/android/financialconnections/ui/components/TestModeBanner.kt
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package com.stripe.android.financialconnections.ui.components | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material.Button | ||
import androidx.compose.material.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.stripe.android.financialconnections.R | ||
import com.stripe.android.financialconnections.ui.theme.FinancialConnectionsTheme | ||
|
||
@Composable | ||
internal fun TestModeBanner( | ||
enabled: Boolean, | ||
buttonLabel: String, | ||
onButtonClick: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
description: String = "You're in test mode.", | ||
) { | ||
Row( | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.spacedBy(8.dp), | ||
modifier = modifier | ||
.fillMaxWidth() | ||
.background( | ||
color = FinancialConnectionsTheme.colors.backgroundCaution, | ||
shape = RoundedCornerShape(12.dp), | ||
) | ||
.padding(horizontal = 8.dp), | ||
) { | ||
Image( | ||
painter = painterResource(R.drawable.stripe_ic_info), | ||
colorFilter = ColorFilter.tint( | ||
color = FinancialConnectionsTheme.colors.iconCaution, | ||
), | ||
contentDescription = null, | ||
) | ||
|
||
Text( | ||
text = description, | ||
style = FinancialConnectionsTheme.typography.bodyMedium, | ||
modifier = Modifier | ||
.padding(vertical = 8.dp) | ||
.weight(1f), | ||
) | ||
|
||
Button( | ||
enabled = enabled, | ||
contentPadding = PaddingValues(horizontal = 8.dp), | ||
colors = FinancialConnectionsButton.Type.Secondary.buttonColors(), | ||
onClick = onButtonClick, | ||
) { | ||
Text(buttonLabel) | ||
} | ||
} | ||
} | ||
|
||
@Preview( | ||
group = "Test Mode Banner", | ||
name = "Enabled", | ||
) | ||
@Composable | ||
internal fun TestModeBannerPreviewEnabled() { | ||
FinancialConnectionsTheme { | ||
TestModeBanner( | ||
enabled = true, | ||
buttonLabel = "Use test code", | ||
onButtonClick = {}, | ||
modifier = Modifier.padding(16.dp), | ||
) | ||
} | ||
} | ||
|
||
@Preview( | ||
group = "Test Mode Banner", | ||
name = "Disabled", | ||
) | ||
@Composable | ||
internal fun TestModeBannerPreviewDisabled() { | ||
FinancialConnectionsTheme { | ||
TestModeBanner( | ||
enabled = false, | ||
buttonLabel = "Use test code", | ||
onButtonClick = {}, | ||
modifier = Modifier.padding(16.dp), | ||
) | ||
} | ||
} |
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
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
Binary file added
BIN
+12.2 KB
...ncialconnections.ui.components_null_TestModeBanner_Disabled_0_null,NEXUS_5].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.51 KB
...ncialconnections.ui.components_null_TestModeBanner_Disabled_0_null,PIXEL_C].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...ancialconnections.ui.components_null_TestModeBanner_Enabled_0_null,NEXUS_5].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.86 KB
...ancialconnections.ui.components_null_TestModeBanner_Enabled_0_null,PIXEL_C].png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.