Files
Klottr/shared/src/commonMain/kotlin/app/klottr/ui/NearbyEntryRow.kt

33 lines
1.2 KiB
Kotlin

package app.klottr.ui
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.foundation.text.BasicText
import androidx.compose.ui.text.TextStyle // Vi kan styra färg från anroparen
@Composable
fun NearbyEntryRow(
label: String, // ✅ huvudtext
subtitle: String, // ✅ undertext
clickable: Boolean, // ✅ klickbar?
onClick: (() -> Unit)? = null, // ✅ callback
textStyle: TextStyle = TextStyle.Default // stil (t.ex. färg) styrs från Android; default oförändrad
) {
var m = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 10.dp)
if (clickable && onClick != null) {
m = m.clickable { onClick() }
}
Column(m) {
BasicText(text = label, style = textStyle) // använd inskickad stil (färg i mörkt läge)
BasicText(text = subtitle, style = textStyle) // använd inskickad stil (färg i mörkt läge)
}
}