73 lines
2.6 KiB
Kotlin
73 lines
2.6 KiB
Kotlin
package dev.beefers.vendetta.manager.ui.widgets.about
|
|
|
|
import androidx.compose.foundation.background
|
|
import androidx.compose.foundation.clickable
|
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
import androidx.compose.foundation.layout.Column
|
|
import androidx.compose.foundation.layout.size
|
|
import androidx.compose.foundation.layout.widthIn
|
|
import androidx.compose.foundation.shape.CircleShape
|
|
import androidx.compose.material.ripple.rememberRipple
|
|
import androidx.compose.material3.MaterialTheme
|
|
import androidx.compose.material3.Text
|
|
import androidx.compose.material3.surfaceColorAtElevation
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.runtime.remember
|
|
import androidx.compose.ui.Alignment
|
|
import androidx.compose.ui.Modifier
|
|
import androidx.compose.ui.draw.clip
|
|
import androidx.compose.ui.platform.LocalUriHandler
|
|
import androidx.compose.ui.text.style.TextAlign
|
|
import androidx.compose.ui.unit.dp
|
|
import androidx.compose.ui.unit.sp
|
|
import coil.compose.AsyncImage
|
|
|
|
@Composable
|
|
fun UserEntry(
|
|
name: String,
|
|
roles: String,
|
|
username: String = name,
|
|
isLarge: Boolean = false
|
|
) {
|
|
val uriHandler = LocalUriHandler.current
|
|
Column(
|
|
horizontalAlignment = Alignment.CenterHorizontally,
|
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
|
modifier = Modifier
|
|
.clickable(
|
|
onClick = { uriHandler.openUri("https://github.com/$username") },
|
|
indication = rememberRipple(bounded = false, radius = 90.dp),
|
|
interactionSource = remember { MutableInteractionSource() }
|
|
)
|
|
.widthIn(min = 100.dp)
|
|
) {
|
|
AsyncImage(
|
|
modifier = Modifier
|
|
.size(if(isLarge) 70.dp else 50.dp)
|
|
.clip(CircleShape)
|
|
.background(MaterialTheme.colorScheme.surfaceColorAtElevation(1.dp)),
|
|
model = "https://github.com/$username.png",
|
|
contentDescription = username
|
|
)
|
|
|
|
Column(
|
|
horizontalAlignment = Alignment.CenterHorizontally
|
|
) {
|
|
Text(
|
|
text = name,
|
|
style = MaterialTheme.typography.titleMedium.copy(
|
|
fontSize = 18.sp
|
|
)
|
|
)
|
|
|
|
Text(
|
|
text = roles,
|
|
style = MaterialTheme.typography.titleSmall.copy(
|
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
|
),
|
|
textAlign = TextAlign.Center
|
|
)
|
|
}
|
|
}
|
|
} |