Skip to content

Commit e81f508

Browse files
committed
fix(theme): remove focused elevation state
1 parent 48e8ff0 commit e81f508

3 files changed

Lines changed: 8 additions & 74 deletions

File tree

‎mobile/kmp/ui/src/commonMain/kotlin/com/atls/hyperion/ui/theme/tokens/elevation/Elevations.kt‎

Lines changed: 8 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,16 @@ import androidx.compose.ui.unit.Dp
55
import com.atls.hyperion.ui.theme.tokens.colors.Colors
66

77
class Elevations(colors: Colors) {
8-
val xs: PressableElevationStates = Xs(colors.elevation.xs, colors.action.subtle)
9-
val sm: PressableElevationStates = Sm(colors.elevation.sm, colors.action.subtle)
10-
val md: PressableElevationStates = Md(colors.elevation.md, colors.action.subtle)
11-
val lg: PressableElevationStates = Lg(colors.elevation.lg, colors.action.subtle)
8+
val xs: PressableElevationStates = Xs(colors.elevation.xs)
9+
val sm: PressableElevationStates = Sm(colors.elevation.sm)
10+
val md: PressableElevationStates = Md(colors.elevation.md)
11+
val lg: PressableElevationStates = Lg(colors.elevation.lg)
1212
val modal: ElevationStates = Modal(colors.elevation.md)
1313

14-
private class Xs(color: Color, focusedColor: Color) : PressableElevationStates {
14+
private class Xs(color: Color) : PressableElevationStates {
1515
override val default = elevation(
1616
drop(color, offsetY = ShadowOffset.xs, blur = ShadowBlur.xs4)
1717
)
18-
override val focused = elevation(
19-
drop(
20-
color,
21-
offsetY = ShadowOffset.xs,
22-
blur = ShadowBlur.xs3,
23-
spread = ShadowSpread.xs
24-
),
25-
drop(
26-
focusedColor,
27-
offsetX = ShadowOffset.xs,
28-
offsetY = ShadowOffset.md,
29-
blur = ShadowBlur.sm,
30-
spread = ShadowSpread.negativeSm
31-
)
32-
)
3318
override val pressed = elevation(
3419
inner(color, offsetY = ShadowOffset.xs, blur = ShadowBlur.xs5),
3520
drop(
@@ -44,25 +29,10 @@ class Elevations(colors: Colors) {
4429
)
4530
}
4631

47-
private class Sm(color: Color, focusedColor: Color) : PressableElevationStates {
32+
private class Sm(color: Color) : PressableElevationStates {
4833
override val default = elevation(
4934
drop(color, offsetY = ShadowOffset.sm, blur = ShadowBlur.sm)
5035
)
51-
override val focused = elevation(
52-
drop(
53-
color,
54-
offsetY = ShadowOffset.sm,
55-
blur = ShadowBlur.md,
56-
spread = ShadowSpread.xs
57-
),
58-
drop(
59-
focusedColor,
60-
offsetX = ShadowOffset.xs,
61-
offsetY = ShadowOffset.lg,
62-
blur = ShadowBlur.md,
63-
spread = ShadowSpread.negativeSm
64-
)
65-
)
6636
override val pressed = elevation(
6737
inner(color, offsetY = ShadowOffset.xs, blur = ShadowBlur.xs4),
6838
drop(
@@ -77,20 +47,10 @@ class Elevations(colors: Colors) {
7747
)
7848
}
7949

80-
private class Md(color: Color, focusedColor: Color) : PressableElevationStates {
50+
private class Md(color: Color) : PressableElevationStates {
8151
override val default = elevation(
8252
drop(color, offsetY = ShadowOffset.lg, blur = ShadowBlur.lg)
8353
)
84-
override val focused = elevation(
85-
drop(color, offsetY = ShadowOffset.lg, blur = ShadowBlur.xl),
86-
drop(
87-
focusedColor,
88-
offsetX = ShadowOffset.xs,
89-
offsetY = ShadowOffset.xl,
90-
blur = ShadowBlur.xl,
91-
spread = ShadowSpread.negativeLg
92-
)
93-
)
9454
override val pressed = elevation(
9555
inner(color, offsetY = ShadowOffset.xs, blur = ShadowBlur.xs3),
9656
drop(
@@ -105,7 +65,7 @@ class Elevations(colors: Colors) {
10565
)
10666
}
10767

108-
private class Lg(color: Color, focusedColor: Color) : PressableElevationStates {
68+
private class Lg(color: Color) : PressableElevationStates {
10969
override val default = elevation(
11070
drop(
11171
color,
@@ -114,21 +74,6 @@ class Elevations(colors: Colors) {
11474
spread = ShadowSpread.negativeLg
11575
)
11676
)
117-
override val focused = elevation(
118-
drop(
119-
color,
120-
offsetY = ShadowOffset.xl2,
121-
blur = ShadowBlur.xl2,
122-
spread = ShadowSpread.negativeLg
123-
),
124-
drop(
125-
focusedColor,
126-
offsetX = ShadowOffset.xs,
127-
offsetY = ShadowOffset.xl,
128-
blur = ShadowBlur.md,
129-
spread = ShadowSpread.negativeXs
130-
)
131-
)
13277
override val pressed = elevation(
13378
inner(color, offsetY = ShadowOffset.sm, blur = ShadowBlur.xs2),
13479
drop(

‎mobile/kmp/ui/src/commonMain/kotlin/com/atls/hyperion/ui/theme/tokens/elevation/Interfaces.kt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ interface ElevationStates {
2828
}
2929

3030
interface PressableElevationStates : ElevationStates {
31-
val focused: Elevation
3231
val pressed: Elevation
3332
val disabled: Elevation
3433
}

‎mobile/kmp/ui/src/commonMain/kotlin/com/atls/hyperion/ui/theme/tokens/elevation/stories/Component.kt‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class ElevationStory : ComponentExample {
3131
@Composable
3232
override fun Content() {
3333
var darkTheme by remember { mutableStateOf(false) }
34-
var focused by remember { mutableStateOf(false) }
3534
var enabled by remember { mutableStateOf(true) }
3635

3736
Theme(darkTheme = darkTheme) {
@@ -58,12 +57,6 @@ class ElevationStory : ComponentExample {
5857
textColor = colors.text.primary,
5958
onCheckedChange = { darkTheme = it }
6059
)
61-
Toggle(
62-
label = "Focused",
63-
checked = focused,
64-
textColor = colors.text.primary,
65-
onCheckedChange = { focused = it }
66-
)
6760
Toggle(
6861
label = "Enabled",
6962
checked = enabled,
@@ -75,7 +68,6 @@ class ElevationStory : ComponentExample {
7568
ElevationCard(
7669
label = label,
7770
states = states,
78-
focused = focused,
7971
enabled = enabled,
8072
backgroundColor = colors.surface.base,
8173
textColor = colors.text.primary
@@ -114,7 +106,6 @@ private fun Toggle(
114106
private fun ElevationCard(
115107
label: String,
116108
states: PressableElevationStates,
117-
focused: Boolean,
118109
enabled: Boolean,
119110
backgroundColor: Color,
120111
textColor: Color
@@ -124,7 +115,6 @@ private fun ElevationCard(
124115
val state = when {
125116
!enabled -> "disabled" to states.disabled
126117
pressed -> "pressed" to states.pressed
127-
focused -> "focused" to states.focused
128118
else -> "default" to states.default
129119
}
130120

0 commit comments

Comments
 (0)