From 759a6ce65a28ff01a478a3f8e2f7bf7ab654aa31 Mon Sep 17 00:00:00 2001
From: davide magli <davide.magli99@gmail.com>
Date: Wed, 4 Oct 2023 16:35:37 +0200
Subject: [PATCH] fixed pr comments

---
 .../kotlin/org/jetbrains/jewel/Tooltip.kt     | 19 +++++++++++--------
 .../jetbrains/jewel/styling/TooltipStyling.kt | 12 ++++++++----
 .../org/jetbrains/jewel/bridge/IntUiBridge.kt |  6 +++---
 .../standalone/styling/IntUiTooltipStyling.kt | 12 ++++++++----
 4 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/core/src/main/kotlin/org/jetbrains/jewel/Tooltip.kt b/core/src/main/kotlin/org/jetbrains/jewel/Tooltip.kt
index ce2b9fea7c..beff944e4a 100644
--- a/core/src/main/kotlin/org/jetbrains/jewel/Tooltip.kt
+++ b/core/src/main/kotlin/org/jetbrains/jewel/Tooltip.kt
@@ -15,8 +15,8 @@ import androidx.compose.ui.unit.DpOffset
 import androidx.compose.ui.unit.dp
 import org.jetbrains.jewel.styling.TooltipStyle
 
-@Composable
-fun Tooltip(
+@Composable fun Tooltip(
+    tooltip: @Composable () -> Unit,
     modifier: Modifier = Modifier,
     tooltipPlacement: TooltipPlacement = TooltipPlacement.ComponentRect(
         alignment = Alignment.CenterEnd,
@@ -24,19 +24,22 @@ fun Tooltip(
         offset = DpOffset(4.dp, 4.dp),
     ),
     style: TooltipStyle = IntelliJTheme.tooltipStyle,
-    tooltip: @Composable () -> Unit,
     content: @Composable () -> Unit,
 ) {
     TooltipArea(
         tooltip = {
             CompositionLocalProvider(
-                LocalContentColor provides style.colors.contentColor,
+                LocalContentColor provides style.colors.content,
             ) {
                 Box(
-                    modifier = Modifier
-                        .background(style.colors.backgroundColor, RoundedCornerShape(8.dp))
-                        .border(1.dp, style.colors.borderColor, shape = RoundedCornerShape(8.dp))
-                        .padding(style.metrics.paddingValues),
+                    modifier = Modifier.background(
+                        color = style.colors.background,
+                        shape = RoundedCornerShape(style.metrics.cornerSize),
+                    ).border(
+                        width = style.metrics.borderWidth,
+                        color = style.colors.border,
+                        shape = RoundedCornerShape(style.metrics.cornerSize),
+                    ).padding(style.metrics.contentPadding),
                 ) {
                     tooltip()
                 }
diff --git a/core/src/main/kotlin/org/jetbrains/jewel/styling/TooltipStyling.kt b/core/src/main/kotlin/org/jetbrains/jewel/styling/TooltipStyling.kt
index 3110ed5430..3686eae95d 100644
--- a/core/src/main/kotlin/org/jetbrains/jewel/styling/TooltipStyling.kt
+++ b/core/src/main/kotlin/org/jetbrains/jewel/styling/TooltipStyling.kt
@@ -1,9 +1,11 @@
 package org.jetbrains.jewel.styling
 
 import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.shape.CornerSize
 import androidx.compose.runtime.Stable
 import androidx.compose.runtime.staticCompositionLocalOf
 import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.unit.Dp
 import kotlin.time.Duration
 
 @Stable
@@ -16,16 +18,18 @@ interface TooltipStyle {
 @Stable
 interface TooltipColors {
 
-    val backgroundColor: Color
-    val contentColor: Color
-    val borderColor: Color
+    val background: Color
+    val content: Color
+    val border: Color
 }
 
 @Stable
 interface TooltipMetrics {
 
-    val paddingValues: PaddingValues
+    val contentPadding: PaddingValues
     val showDelay: Duration
+    val cornerSize: CornerSize
+    val borderWidth: Dp
 }
 
 val LocalTooltipStyle = staticCompositionLocalOf<TooltipStyle> {
diff --git a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt
index 641611733f..ef1a8d193b 100644
--- a/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt
+++ b/ide-laf-bridge/src/main/kotlin/org/jetbrains/jewel/bridge/IntUiBridge.kt
@@ -909,9 +909,9 @@ private fun readTooltipStyle(
     return IntUiTooltipStyle(
         metrics = IntUiTooltipMetrics(),
         colors = IntUiTooltipColors(
-            contentColor = retrieveColorOrUnspecified(content),
-            backgroundColor = retrieveColorOrUnspecified(background),
-            borderColor = retrieveColorOrUnspecified("Tooltip.borderColor"),
+            content = retrieveColorOrUnspecified(content),
+            background = retrieveColorOrUnspecified(background),
+            border = retrieveColorOrUnspecified("Tooltip.borderColor"),
         ),
     )
 }
diff --git a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStyling.kt b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStyling.kt
index e605e0d2ef..f6c39468d7 100644
--- a/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStyling.kt
+++ b/int-ui/int-ui-standalone/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiTooltipStyling.kt
@@ -1,9 +1,11 @@
 package org.jetbrains.jewel.intui.standalone.styling
 
 import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.foundation.shape.CornerSize
 import androidx.compose.runtime.Composable
 import androidx.compose.runtime.Stable
 import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.unit.Dp
 import androidx.compose.ui.unit.dp
 import org.jetbrains.jewel.IntelliJTheme
 import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme
@@ -44,9 +46,9 @@ data class IntUiTooltipStyle(
 
 @Stable
 data class IntUiTooltipColors(
-    override val contentColor: Color,
-    override val backgroundColor: Color,
-    override val borderColor: Color,
+    override val content: Color,
+    override val background: Color,
+    override val border: Color,
 ) : TooltipColors {
 
     companion object {
@@ -69,6 +71,8 @@ data class IntUiTooltipColors(
 
 @Stable
 data class IntUiTooltipMetrics(
-    override val paddingValues: PaddingValues = PaddingValues(vertical = 8.dp, horizontal = 8.dp),
+    override val contentPadding: PaddingValues = PaddingValues(vertical = 8.dp, horizontal = 8.dp),
     override val showDelay: Duration = 0.milliseconds,
+    override val cornerSize: CornerSize = CornerSize(8.dp),
+    override val borderWidth: Dp = 1.dp,
 ) : TooltipMetrics