Skip to content

Commit 21f488a

Browse files
committed
refactor(theme): consolidate design system, remove legacy theme
1 parent 5d585a4 commit 21f488a

6 files changed

Lines changed: 28 additions & 124 deletions

File tree

apps/flipcash/shared/theme/src/main/kotlin/com/flipcash/app/theme/FlipcashPreview.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,15 @@ import androidx.compose.runtime.CompositionLocalProvider
99
import androidx.compose.ui.Modifier
1010
import androidx.compose.ui.graphics.Color
1111
import androidx.compose.ui.tooling.preview.Preview
12-
import androidx.compose.ui.tooling.preview.PreviewWrapper
1312
import androidx.compose.ui.tooling.preview.PreviewWrapperProvider
1413
import com.getcode.animation.LocalSharedTransitionScope
1514
import com.flipcash.app.theme.internal.Flipcash2DesignSystem
16-
import com.flipcash.app.theme.internal.FlipcashLegacyDesignSystem
1715
import com.getcode.theme.CodeTheme
1816

1917
@Deprecated("Use FlipcashThemeWrapper")
2018
@Composable
2119
fun FlipcashPreview(
2220
showBackground: Boolean = false,
23-
useLegacyColors: Boolean = false,
2421
content: @Composable () -> Unit
2522
) {
2623
val previewContent = @Composable {
@@ -39,11 +36,7 @@ fun FlipcashPreview(
3936
}
4037
}
4138

42-
if (useLegacyColors) {
43-
FlipcashLegacyDesignSystem(previewContent)
44-
} else {
45-
Flipcash2DesignSystem(previewContent)
46-
}
39+
Flipcash2DesignSystem(previewContent)
4740
}
4841

4942
class FlipcashThemeWrapper: PreviewWrapperProvider {

apps/flipcash/shared/theme/src/main/kotlin/com/flipcash/app/theme/FlipcashTheme.kt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@ package com.flipcash.app.theme
22

33
import androidx.compose.runtime.Composable
44
import com.flipcash.app.theme.internal.Flipcash2DesignSystem
5-
import com.flipcash.app.theme.internal.FlipcashLegacyDesignSystem
65

76
@Composable
87
fun FlipcashTheme(
9-
useLegacyColors: Boolean = false,
108
content: @Composable () -> Unit,
119
) {
12-
if (useLegacyColors) {
13-
FlipcashLegacyDesignSystem(content)
14-
} else {
15-
Flipcash2DesignSystem(content)
16-
}
10+
Flipcash2DesignSystem(content)
1711
}

apps/flipcash/shared/theme/src/main/kotlin/com/flipcash/app/theme/internal/Flipcash2DesignSystem.kt renamed to apps/flipcash/shared/theme/src/main/kotlin/com/flipcash/app/theme/internal/FlipcashDesignSystem.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ object Flipcash2ColorSpec {
5252
borderColor = null,
5353
borderWidth = 0f,
5454
)
55+
val contactAvatar = GradientSpec(
56+
background = Color.Black,
57+
colors = listOf(
58+
Color(0xFF414141),
59+
Color(0xFF202020)
60+
),
61+
stops = listOf(0f, 1f)
62+
)
5563
}
5664

5765
private val colors = with(Flipcash2ColorSpec) {
@@ -94,7 +102,8 @@ private val colors = with(Flipcash2ColorSpec) {
94102
bannerWarning = Warning,
95103
bannerSuccess = BannerSuccess,
96104
scrim = Black40,
97-
accessKey = accessKey
105+
accessKey = accessKey,
106+
contactAvatar = contactAvatar,
98107
)
99108
}
100109
@Composable

apps/flipcash/shared/theme/src/main/kotlin/com/flipcash/app/theme/internal/FlipcashLegacyDesignSystem.kt

Lines changed: 0 additions & 107 deletions
This file was deleted.

ui/theme/src/main/kotlin/com/getcode/theme/Color.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ val CodeAccessKey = GradientSpec(
6868
stops = listOf(0f, 0.3f, 0.6f, 1f)
6969
)
7070

71+
val CodeContactAvatar = GradientSpec(
72+
background = Brand,
73+
colors = listOf(
74+
Color(0xFF4A5568),
75+
Color(0xFF6B7A90),
76+
),
77+
stops = listOf(0f, 1f)
78+
)
79+
7180
data class GradientSpec(
7281
val background: Color,
7382
val colors: List<Color>,

ui/theme/src/main/kotlin/com/getcode/theme/Theme.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ internal val CodeDefaultColorScheme = ColorScheme(
5858
bannerSuccess = BannerSuccess,
5959
scrim = Black40,
6060
accessKey = CodeAccessKey,
61+
contactAvatar = CodeContactAvatar,
6162
)
6263

6364
@Composable
@@ -148,6 +149,7 @@ class ColorScheme(
148149
bannerSuccess: Color,
149150
scrim: Color,
150151
accessKey: GradientSpec,
152+
contactAvatar: GradientSpec,
151153
) {
152154
var brand by mutableStateOf(brand)
153155
private set
@@ -230,6 +232,8 @@ class ColorScheme(
230232

231233
var accessKey by mutableStateOf(accessKey)
232234
private set
235+
var contactAvatar by mutableStateOf(contactAvatar)
236+
private set
233237

234238

235239
fun update(other: ColorScheme) {
@@ -272,6 +276,7 @@ class ColorScheme(
272276
bannerSuccess = other.bannerSuccess
273277
scrim = other.scrim
274278
accessKey = other.accessKey
279+
contactAvatar = other.contactAvatar
275280
}
276281

277282
fun copy(): ColorScheme = ColorScheme(
@@ -314,6 +319,7 @@ class ColorScheme(
314319
bannerSuccess = bannerSuccess,
315320
scrim = scrim,
316321
accessKey = accessKey,
322+
contactAvatar = contactAvatar,
317323
)
318324
}
319325

@@ -361,7 +367,7 @@ fun inputColors(
361367
borderColor: Color = CodeTheme.colors.border,
362368
unfocusedBorderColor: Color = borderColor,
363369
backgroundColor: Color = White05,
364-
placeholderColor: Color = CodeTheme.colors.textTertiary,
370+
placeholderColor: Color = CodeTheme.colors.textSecondary,
365371
cursorColor: Color = Color.White,
366372
errorBorderColor: Color = CodeTheme.colors.error,
367373
) = TextFieldDefaults.outlinedTextFieldColors(

0 commit comments

Comments
 (0)