Added new tooltip component
This commit is contained in:
parent
55ebd9ee0d
commit
1835ff748d
31
src/main/kotlin/app/ui/components/Tooltip.kt
Normal file
31
src/main/kotlin/app/ui/components/Tooltip.kt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package app.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
|
import androidx.compose.foundation.TooltipArea
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.material.Card
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@Composable
|
||||||
|
fun Tooltip(text: String, content: @Composable () -> Unit) {
|
||||||
|
TooltipArea(
|
||||||
|
tooltip = {
|
||||||
|
Card(
|
||||||
|
backgroundColor = MaterialTheme.colors.background,
|
||||||
|
elevation = 10.dp,
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = text,
|
||||||
|
modifier = Modifier.padding(8.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
content()
|
||||||
|
}
|
||||||
|
}
|
@ -42,18 +42,8 @@ fun TooltipText(
|
|||||||
style: TextStyle = LocalTextStyle.current,
|
style: TextStyle = LocalTextStyle.current,
|
||||||
tooltipTitle: String,
|
tooltipTitle: String,
|
||||||
) {
|
) {
|
||||||
TooltipArea(
|
Tooltip(
|
||||||
tooltip = {
|
text = tooltipTitle,
|
||||||
Card(
|
|
||||||
backgroundColor = MaterialTheme.colors.background,
|
|
||||||
elevation = 10.dp,
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = tooltipTitle,
|
|
||||||
modifier = Modifier.padding(10.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text,
|
||||||
|
Loading…
Reference in New Issue
Block a user