Skip to content

Commit

Permalink
Merge branch 'main' into icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Walingar authored Oct 13, 2023
2 parents 1bc75f0 + cc26ad9 commit 13feb8e
Showing 3 changed files with 27 additions and 18 deletions.
37 changes: 24 additions & 13 deletions buildSrc/src/main/kotlin/IdeaConfiguration.kt
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
import java.util.concurrent.atomic.AtomicBoolean
import org.gradle.api.Project

enum class SupportedIJVersion {
IJ_232,
IJ_233
}

private var warned = AtomicBoolean(false)

fun Project.supportedIJVersion(): SupportedIJVersion {
val prop = localProperty("supported.ij.version")
?: rootProject.property("supported.ij.version")
?: error(
"'supported.ij.version' gradle property is missing. " +
"Please, provide it using local.properties file or -Psupported.ij.version argument in CLI"
)
val prop = kotlin.runCatching {
localProperty("supported.ij.version")
?: rootProject.property("supported.ij.version")?.toString()
}.getOrNull()

if (prop == null) {
if (!warned.getAndSet(true)) {
logger.warn(
"""
No 'supported.ij.version' property provided. Falling back to IJ 233.
It is recommended to provide it using local.properties file or -Psupported.ij.version to avoid unexpected behavior.
""".trimIndent()
)
}
return SupportedIJVersion.IJ_233
}

return when (prop) {
"232" -> SupportedIJVersion.IJ_232
"233" -> SupportedIJVersion.IJ_233
else -> {
error(
"Invalid 'supported.ij.version' with value '$prop' is provided. " +
"It should be in set of these values: ('232', '233')"
)
}
else -> error(
"Invalid 'supported.ij.version' with value '$prop' is provided. " +
"It should be in set of these values: ('232', '233')"
)
}
}
}
6 changes: 2 additions & 4 deletions core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.semantics.Role
import org.jetbrains.jewel.styling.IconButtonStyle

@@ -70,10 +69,9 @@ fun IconButton(
interactionSource = interactionSource,
indication = NoIndication,
)
.clip(shape)
.padding(style.metrics.padding)
.background(background)
.border(style.metrics.borderWidth, border),
.background(background, shape)
.border(style.metrics.borderWidth, border, shape),
contentAlignment = Alignment.Center,
content = {
content(buttonState)
Original file line number Diff line number Diff line change
@@ -49,9 +49,9 @@ interface IconButtonColors {
fun borderFor(state: ButtonState) = rememberUpdatedState(
when {
!state.isEnabled -> borderDisabled
state.isFocused -> borderFocused
state.isPressed -> borderPressed
state.isHovered -> borderHovered
state.isFocused -> borderFocused
else -> border
},
)

0 comments on commit 13feb8e

Please sign in to comment.