-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AND-302] menu item stateless components (#5608)
* Introduce factory for menu items channel menu, message menu and reactions menu. * Api Dump and default values changes * Spotless * Merge conflict and api & spotless * Fix lint * Fix default height of message menu item * Do not break the old composables by not exposing the parameters * Spotless & Api Dump * Make MessageOptionItemDeprecated * Fix merge issues * Remove padding declaration in the factory. * Rename the public function WITHOUT `Generic` * ApiDump * spotless * Fix padding
- Loading branch information
1 parent
bf50b25
commit 582e8b8
Showing
15 changed files
with
918 additions
and
504 deletions.
There are no files selected for viewing
77 changes: 60 additions & 17 deletions
77
stream-chat-android-compose/api/stream-chat-android-compose.api
Large diffs are not rendered by default.
Oops, something went wrong.
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
106 changes: 0 additions & 106 deletions
106
.../main/java/io/getstream/chat/android/compose/ui/components/channels/ChannelOptionsItem.kt
This file was deleted.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
...se/src/main/java/io/getstream/chat/android/compose/ui/components/common/MenuOptionItem.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,84 @@ | ||
/* | ||
* Copyright (c) 2014-2025 Stream.io Inc. All rights reserved. | ||
* | ||
* Licensed under the Stream License; | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://github.com/GetStream/stream-chat-android/blob/main/LICENSE | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.getstream.chat.android.compose.ui.components.common | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.interaction.MutableInteractionSource | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.RowScope | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.ripple | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.platform.testTag | ||
import androidx.compose.ui.text.TextStyle | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import io.getstream.chat.android.compose.ui.theme.ChatTheme | ||
|
||
/** | ||
* Represents a generic menu option item that can be used in a list of options. | ||
* | ||
* @param modifier Modifier for styling. | ||
* @param onClick Handler called when the item is clicked. | ||
* @param leadingIcon The icon to show on the left side of the item. | ||
* @param title The title of the item. | ||
* @param titleColor The color of the title. | ||
* @param style The style of the title. | ||
* @param itemHeight The height of the item. | ||
* @param verticalAlignment Used to apply vertical alignment. | ||
* @param horizontalArrangement Used to apply horizontal arrangement. | ||
*/ | ||
@Composable | ||
public fun MenuOptionItem( | ||
modifier: Modifier = Modifier, | ||
onClick: () -> Unit, | ||
leadingIcon: @Composable RowScope.() -> Unit, | ||
title: String, | ||
titleColor: Color, | ||
style: TextStyle = ChatTheme.typography.bodyBold, | ||
itemHeight: Dp = 56.dp, | ||
verticalAlignment: Alignment.Vertical = Alignment.CenterVertically, | ||
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, | ||
) { | ||
Row( | ||
modifier | ||
.fillMaxWidth() | ||
.height(itemHeight) | ||
.clickable( | ||
onClick = onClick, | ||
indication = ripple(), | ||
interactionSource = remember { MutableInteractionSource() }, | ||
), | ||
verticalAlignment = verticalAlignment, | ||
horizontalArrangement = horizontalArrangement, | ||
) { | ||
leadingIcon() | ||
Text( | ||
modifier = Modifier.testTag("Stream_ContextMenu_$title"), | ||
text = title, | ||
style = style, | ||
color = titleColor, | ||
) | ||
} | ||
} |
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
Oops, something went wrong.