feature(space): make sure to handle topic properly
This commit is contained in:
parent
dbc0c42e31
commit
9d05eb8e6f
7 changed files with 102 additions and 3 deletions
|
|
@ -20,6 +20,7 @@ import androidx.compose.runtime.mutableStateOf
|
|||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.text.AnnotatedString
|
||||
|
|
@ -51,6 +52,7 @@ fun ClickableLinkText(
|
|||
onClick: () -> Unit = {},
|
||||
onLongClick: () -> Unit = {},
|
||||
style: TextStyle = LocalTextStyle.current,
|
||||
color: Color = Color.Unspecified,
|
||||
inlineContent: ImmutableMap<String, InlineTextContent> = persistentMapOf(),
|
||||
) {
|
||||
ClickableLinkText(
|
||||
|
|
@ -62,6 +64,7 @@ fun ClickableLinkText(
|
|||
onClick = onClick,
|
||||
onLongClick = onLongClick,
|
||||
style = style,
|
||||
color = color,
|
||||
inlineContent = inlineContent,
|
||||
)
|
||||
}
|
||||
|
|
@ -76,6 +79,7 @@ fun ClickableLinkText(
|
|||
onClick: () -> Unit = {},
|
||||
onLongClick: () -> Unit = {},
|
||||
style: TextStyle = LocalTextStyle.current,
|
||||
color: Color = Color.Unspecified,
|
||||
inlineContent: ImmutableMap<String, InlineTextContent> = persistentMapOf(),
|
||||
) {
|
||||
@Suppress("NAME_SHADOWING")
|
||||
|
|
@ -126,6 +130,7 @@ fun ClickableLinkText(
|
|||
text = annotatedString,
|
||||
modifier = modifier.then(pressIndicator),
|
||||
style = style,
|
||||
color = color,
|
||||
onTextLayout = {
|
||||
layoutResult.value = it
|
||||
},
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
package io.element.android.libraries.matrix.ui.components
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
|
|
@ -43,6 +44,7 @@ fun SpaceHeaderView(
|
|||
numberOfMembers: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
topicMaxLines: Int = Int.MAX_VALUE,
|
||||
onTopicClick: ((String) -> Unit)? = null,
|
||||
) {
|
||||
RoomPreviewOrganism(
|
||||
modifier = modifier.padding(24.dp),
|
||||
|
|
@ -68,7 +70,16 @@ fun SpaceHeaderView(
|
|||
description = if (topic.isNullOrBlank()) {
|
||||
null
|
||||
} else {
|
||||
{ RoomPreviewDescriptionAtom(description = topic, maxLines = topicMaxLines) }
|
||||
{
|
||||
RoomPreviewDescriptionAtom(
|
||||
description = topic,
|
||||
maxLines = topicMaxLines,
|
||||
modifier = Modifier.clickable(
|
||||
enabled = onTopicClick != null,
|
||||
onClick = { onTopicClick?.invoke(topic) }
|
||||
)
|
||||
)
|
||||
}
|
||||
},
|
||||
memberCount = {
|
||||
SpaceMembersView(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue