-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1919 from HedvigInsurance/feature/payments
Updated payments screens
- Loading branch information
Showing
39 changed files
with
2,571 additions
and
1,343 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
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
103 changes: 103 additions & 0 deletions
103
app/core/core-ui/src/main/kotlin/com/hedvig/android/core/ui/infocard/ErrorCard.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,103 @@ | ||
package com.hedvig.android.core.ui.infocard | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material3.CardColors | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.unit.dp | ||
import com.hedvig.android.core.designsystem.component.card.HedvigInfoCard | ||
import com.hedvig.android.core.designsystem.preview.HedvigPreview | ||
import com.hedvig.android.core.designsystem.theme.HedvigTheme | ||
import com.hedvig.android.core.icons.Hedvig | ||
import com.hedvig.android.core.icons.hedvig.normal.WarningFilled | ||
|
||
@Composable | ||
fun VectorErrorCard( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
icon: ImageVector = Icons.Hedvig.WarningFilled, | ||
iconColor: Color = MaterialTheme.colorScheme.error, | ||
colors: CardColors = CardDefaults.outlinedCardColors( | ||
containerColor = MaterialTheme.colorScheme.errorContainer, | ||
contentColor = MaterialTheme.colorScheme.onErrorContainer, | ||
), | ||
) { | ||
VectorErrorCard( | ||
text = text, | ||
modifier = modifier, | ||
icon = icon, | ||
iconColor = iconColor, | ||
colors = colors, | ||
underTextContent = null, | ||
) | ||
} | ||
|
||
@Composable | ||
fun VectorErrorCard( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
icon: ImageVector = Icons.Hedvig.WarningFilled, | ||
iconColor: Color = MaterialTheme.colorScheme.error, | ||
colors: CardColors = CardDefaults.outlinedCardColors( | ||
containerColor = MaterialTheme.colorScheme.errorContainer, | ||
contentColor = MaterialTheme.colorScheme.onErrorContainer, | ||
), | ||
underTextContent: @Composable (ColumnScope.() -> Unit)?, | ||
) { | ||
HedvigInfoCard( | ||
modifier = modifier, | ||
contentPadding = PaddingValues( | ||
start = 12.dp, | ||
top = 12.dp, | ||
end = 16.dp, | ||
bottom = 12.dp, | ||
), | ||
colors = colors, | ||
) { | ||
Icon( | ||
imageVector = icon, | ||
contentDescription = "info", | ||
modifier = Modifier | ||
.padding(top = 2.dp) | ||
.size(16.dp), | ||
tint = iconColor, | ||
) | ||
Spacer(Modifier.width(8.dp)) | ||
Column { | ||
Text( | ||
text = text, | ||
style = MaterialTheme.typography.bodyMedium, | ||
) | ||
if (underTextContent != null) { | ||
Spacer(Modifier.height(12.dp)) | ||
underTextContent() | ||
Spacer(Modifier.height(4.dp)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@HedvigPreview | ||
@Composable | ||
private fun PreviewVectorInfoCard() { | ||
HedvigTheme { | ||
Surface(color = MaterialTheme.colorScheme.background) { | ||
VectorErrorCard("Lorem ipsum") | ||
} | ||
} | ||
} |
106 changes: 106 additions & 0 deletions
106
app/core/core-ui/src/main/kotlin/com/hedvig/android/core/ui/infocard/SuccessCard.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,106 @@ | ||
package com.hedvig.android.core.ui.infocard | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.ColumnScope | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material3.CardColors | ||
import androidx.compose.material3.CardDefaults | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.unit.dp | ||
import com.hedvig.android.core.designsystem.component.card.HedvigInfoCard | ||
import com.hedvig.android.core.designsystem.material3.onTypeContainer | ||
import com.hedvig.android.core.designsystem.material3.typeContainer | ||
import com.hedvig.android.core.designsystem.material3.typeElement | ||
import com.hedvig.android.core.designsystem.preview.HedvigPreview | ||
import com.hedvig.android.core.designsystem.theme.HedvigTheme | ||
import com.hedvig.android.core.icons.Hedvig | ||
import com.hedvig.android.core.icons.hedvig.small.hedvig.Checkmark | ||
|
||
@Composable | ||
fun VectorSuccessCard( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
icon: ImageVector = Icons.Hedvig.Checkmark, | ||
iconColor: Color = MaterialTheme.colorScheme.typeElement, | ||
colors: CardColors = CardDefaults.outlinedCardColors( | ||
containerColor = MaterialTheme.colorScheme.typeContainer, | ||
contentColor = MaterialTheme.colorScheme.onTypeContainer, | ||
), | ||
) { | ||
VectorSuccessCard( | ||
text = text, | ||
modifier = modifier, | ||
icon = icon, | ||
iconColor = iconColor, | ||
colors = colors, | ||
underTextContent = null, | ||
) | ||
} | ||
|
||
@Composable | ||
fun VectorSuccessCard( | ||
text: String, | ||
modifier: Modifier = Modifier, | ||
icon: ImageVector = Icons.Hedvig.Checkmark, | ||
iconColor: Color = MaterialTheme.colorScheme.typeElement, | ||
colors: CardColors = CardDefaults.outlinedCardColors( | ||
containerColor = MaterialTheme.colorScheme.typeContainer, | ||
contentColor = MaterialTheme.colorScheme.onTypeContainer, | ||
), | ||
underTextContent: @Composable (ColumnScope.() -> Unit)?, | ||
) { | ||
HedvigInfoCard( | ||
modifier = modifier, | ||
contentPadding = PaddingValues( | ||
start = 12.dp, | ||
top = 12.dp, | ||
end = 16.dp, | ||
bottom = 12.dp, | ||
), | ||
colors = colors, | ||
) { | ||
Icon( | ||
imageVector = icon, | ||
contentDescription = "info", | ||
modifier = Modifier | ||
.padding(top = 2.dp) | ||
.size(16.dp), | ||
tint = iconColor, | ||
) | ||
Spacer(Modifier.width(8.dp)) | ||
Column { | ||
Text( | ||
text = text, | ||
style = MaterialTheme.typography.bodyMedium, | ||
) | ||
if (underTextContent != null) { | ||
Spacer(Modifier.height(12.dp)) | ||
underTextContent() | ||
Spacer(Modifier.height(4.dp)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@HedvigPreview | ||
@Composable | ||
private fun PreviewVectorSuccessCard() { | ||
HedvigTheme { | ||
Surface(color = MaterialTheme.colorScheme.background) { | ||
VectorSuccessCard("Lorem ipsum") | ||
} | ||
} | ||
} |
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
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
7 changes: 7 additions & 0 deletions
7
app/feature/feature-payments/src/main/graphql/MutationAddDiscount.graphql
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,7 @@ | ||
mutation AddDiscount($code: String!) { | ||
memberCampaignsRedeem(code: $code) { | ||
userError { | ||
message | ||
} | ||
} | ||
} |
Oops, something went wrong.