Skip to content

Commit 8b71005

Browse files
authored
Merge pull request #6314 from element-hq/feature/bma/sendButtonColors
Iterate on send button colors
2 parents 58351c6 + 37cc0d3 commit 8b71005

File tree

97 files changed

+201
-229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+201
-229
lines changed

libraries/textcomposer/impl/src/main/kotlin/io/element/android/libraries/textcomposer/components/SendButtonIcon.kt

Lines changed: 9 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
package io.element.android.libraries.textcomposer.components
1010

11+
import androidx.compose.foundation.background
1112
import androidx.compose.foundation.layout.Box
1213
import androidx.compose.foundation.layout.Row
1314
import androidx.compose.foundation.layout.padding
@@ -17,14 +18,10 @@ import androidx.compose.runtime.Composable
1718
import androidx.compose.ui.Alignment
1819
import androidx.compose.ui.Modifier
1920
import androidx.compose.ui.draw.clip
20-
import androidx.compose.ui.draw.drawWithCache
21-
import androidx.compose.ui.geometry.Offset
22-
import androidx.compose.ui.graphics.LinearGradientShader
23-
import androidx.compose.ui.graphics.ShaderBrush
21+
import androidx.compose.ui.graphics.Color
2422
import androidx.compose.ui.unit.dp
2523
import io.element.android.compound.theme.ElementTheme
2624
import io.element.android.compound.tokens.generated.CompoundIcons
27-
import io.element.android.libraries.designsystem.colors.gradientActionColors
2825
import io.element.android.libraries.designsystem.preview.ElementPreview
2926
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
3027
import io.element.android.libraries.designsystem.theme.components.Icon
@@ -33,7 +30,6 @@ import io.element.android.libraries.designsystem.theme.components.IconButton
3330
/**
3431
* Send button for the message composer.
3532
* Figma: https://www.figma.com/design/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?node-id=1956-37575&node-type=frame&m=dev
36-
* Temporary Figma : https://www.figma.com/design/Ni6Ii8YKtmXCKYNE90cC67/Timeline-(new)?node-id=2274-39944&m=dev
3733
*/
3834
@Composable
3935
internal fun SendButtonIcon(
@@ -49,11 +45,16 @@ internal fun SendButtonIcon(
4945
isEditing -> 0.dp
5046
else -> 2.dp
5147
}
48+
val backgroundColor = if (canSendMessage) {
49+
ElementTheme.colors.bgAccentRest
50+
} else {
51+
Color.Transparent
52+
}
5253
Box(
5354
modifier = modifier
5455
.clip(CircleShape)
5556
.size(36.dp)
56-
.buttonBackgroundModifier(canSendMessage)
57+
.background(backgroundColor)
5758
) {
5859
Icon(
5960
modifier = Modifier
@@ -63,43 +64,14 @@ internal fun SendButtonIcon(
6364
// Note: accessibility is managed in TextComposer.
6465
contentDescription = null,
6566
tint = if (canSendMessage) {
66-
if (ElementTheme.colors.isLight) {
67-
ElementTheme.colors.iconOnSolidPrimary
68-
} else {
69-
ElementTheme.colors.iconPrimary
70-
}
67+
ElementTheme.colors.iconOnSolidPrimary
7168
} else {
7269
ElementTheme.colors.iconQuaternary
7370
}
7471
)
7572
}
7673
}
7774

78-
@Composable
79-
private fun Modifier.buttonBackgroundModifier(
80-
canSendMessage: Boolean,
81-
) = then(
82-
if (canSendMessage) {
83-
val colors = gradientActionColors()
84-
Modifier.drawWithCache {
85-
val verticalGradientBrush = ShaderBrush(
86-
LinearGradientShader(
87-
from = Offset(0f, 0f),
88-
to = Offset(0f, size.height),
89-
colors = colors,
90-
)
91-
)
92-
onDrawBehind {
93-
drawRect(
94-
brush = verticalGradientBrush,
95-
)
96-
}
97-
}
98-
} else {
99-
Modifier
100-
}
101-
)
102-
10375
@PreviewsDayNight
10476
@Composable
10577
internal fun SendButtonIconPreview() = ElementPreview {
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)