Skip to content

Commit

Permalink
Add hover cursor pointer to Link component (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
fscarponi authored Sep 20, 2023
1 parent 881dd19 commit dade956
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/kotlin/org/jetbrains/jewel/Link.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.input.InputMode
import androidx.compose.ui.input.pointer.PointerIcon
import androidx.compose.ui.input.pointer.pointerHoverIcon
import androidx.compose.ui.platform.LocalInputModeManager
import androidx.compose.ui.res.ResourceLoader
import androidx.compose.ui.semantics.Role
Expand All @@ -49,6 +51,7 @@ import org.jetbrains.jewel.styling.LocalMenuStyle
import org.jetbrains.jewel.styling.MenuStyle
import org.jetbrains.jewel.styling.PainterProvider
import org.jetbrains.jewel.util.appendIf
import java.awt.Cursor

@Composable
fun Link(
Expand Down Expand Up @@ -286,9 +289,12 @@ private fun LinkImpl(
shape = RoundedCornerShape(style.metrics.focusHaloCornerSize),
)

val pointerChangeModifier = Modifier.pointerHoverIcon(PointerIcon(Cursor(Cursor.HAND_CURSOR)))

Row(
modifier = modifier.then(clickable)
.appendIf(linkState.isFocused) { focusHaloModifier },
.appendIf(linkState.isFocused) { focusHaloModifier }
.appendIf(linkState.isEnabled) { pointerChangeModifier },
horizontalArrangement = Arrangement.spacedBy(style.metrics.textIconGap),
verticalAlignment = Alignment.CenterVertically,
) {
Expand Down

0 comments on commit dade956

Please sign in to comment.