Skip to content

Commit

Permalink
Add color to social context component
Browse files Browse the repository at this point in the history
  • Loading branch information
wingio committed Dec 11, 2023
1 parent 9734a5f commit 18c684d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/xyz/wingio/dimett/ui/widgets/posts/Post.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import xyz.wingio.dimett.ast.EmojiSyntakts
import xyz.wingio.dimett.ast.render
import xyz.wingio.dimett.rest.dto.post.Post
import xyz.wingio.dimett.ui.components.Text
import xyz.wingio.dimett.ui.theme.additionalColors
import xyz.wingio.dimett.ui.widgets.attachments.Attachments
import xyz.wingio.dimett.utils.getString
import xyz.wingio.dimett.utils.processPostContent
Expand Down Expand Up @@ -88,9 +89,10 @@ fun Post(
if (post.boosted != null) {
val str = stringResource(R.string.post_user_boosted, post.author.displayName)

PostInfoBar(
SocialContext(
icon = Icons.Outlined.Repeat,
iconDescription = R.string.cd_boosted,
iconColor = MaterialTheme.additionalColors.boost,
text = EmojiSyntakts.render(str, post.author.emojis.toEmojiMap(), emptyMap())
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Icon
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ProvideTextStyle
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import xyz.wingio.dimett.ui.components.Text

/**
* Displays some additional information about a post
* Provides information for why a particular post appeared in the feed
*/
@Composable
fun PostInfoBar(
fun SocialContext(
icon: ImageVector,
@StringRes iconDescription: Int,
iconColor: Color,
text: AnnotatedString
) {
Row(
Expand All @@ -37,11 +40,13 @@ fun PostInfoBar(
Icon(
imageVector = icon,
contentDescription = stringResource(iconDescription),
tint = iconColor,
modifier = Modifier.size(18.dp)
)
Text(
text = text,
style = MaterialTheme.typography.labelSmall
style = MaterialTheme.typography.labelSmall,
color = LocalContentColor.current.copy(alpha = 0.7f)
)
}
}

0 comments on commit 18c684d

Please sign in to comment.