-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
GroupHeaderStyle refactor, simplify other styling
Showing
8 changed files
with
251 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 26 additions & 51 deletions
77
...e/src/main/kotlin/org/jetbrains/jewel/intui/standalone/styling/IntUiGroupHeaderStyling.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,38 @@ | ||
package org.jetbrains.jewel.intui.standalone.styling | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.Immutable | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
import org.jetbrains.jewel.GenerateDataFunctions | ||
import org.jetbrains.jewel.intui.core.theme.IntUiDarkTheme | ||
import org.jetbrains.jewel.intui.core.theme.IntUiLightTheme | ||
import org.jetbrains.jewel.styling.GroupHeaderColors | ||
import org.jetbrains.jewel.styling.GroupHeaderMetrics | ||
import org.jetbrains.jewel.styling.GroupHeaderStyle | ||
|
||
@Immutable | ||
@GenerateDataFunctions | ||
class IntUiGroupHeaderStyle( | ||
override val colors: IntUiGroupHeaderColors, | ||
override val metrics: IntUiGroupHeaderMetrics, | ||
) : GroupHeaderStyle { | ||
|
||
companion object { | ||
|
||
@Composable | ||
fun light( | ||
colors: IntUiGroupHeaderColors = IntUiGroupHeaderColors.light(), | ||
metrics: IntUiGroupHeaderMetrics = IntUiGroupHeaderMetrics(), | ||
) = IntUiGroupHeaderStyle(colors, metrics) | ||
|
||
@Composable | ||
fun dark( | ||
colors: IntUiGroupHeaderColors = IntUiGroupHeaderColors.dark(), | ||
metrics: IntUiGroupHeaderMetrics = IntUiGroupHeaderMetrics(), | ||
) = IntUiGroupHeaderStyle(colors, metrics) | ||
} | ||
} | ||
|
||
@Immutable | ||
@GenerateDataFunctions | ||
class IntUiGroupHeaderColors( | ||
override val divider: Color, | ||
) : GroupHeaderColors { | ||
|
||
companion object { | ||
|
||
@Composable | ||
fun light( | ||
divider: Color = IntUiLightTheme.colors.grey(12), | ||
) = IntUiGroupHeaderColors(divider) | ||
|
||
@Composable | ||
fun dark( | ||
divider: Color = IntUiDarkTheme.colors.grey(3), | ||
) = IntUiGroupHeaderColors(divider) | ||
} | ||
} | ||
|
||
@Immutable | ||
@GenerateDataFunctions | ||
class IntUiGroupHeaderMetrics( | ||
override val dividerThickness: Dp = 1.dp, | ||
override val indent: Dp = 8.dp, | ||
) : GroupHeaderMetrics | ||
@Composable | ||
fun GroupHeaderStyle.Companion.light( | ||
colors: GroupHeaderColors = GroupHeaderColors.light(), | ||
metrics: GroupHeaderMetrics = GroupHeaderMetrics.defaults(), | ||
) = GroupHeaderStyle(colors, metrics) | ||
|
||
@Composable | ||
fun GroupHeaderStyle.Companion.dark( | ||
colors: GroupHeaderColors = GroupHeaderColors.dark(), | ||
metrics: GroupHeaderMetrics = GroupHeaderMetrics.defaults(), | ||
) = GroupHeaderStyle(colors, metrics) | ||
|
||
@Composable | ||
fun GroupHeaderColors.Companion.light( | ||
divider: Color = IntUiLightTheme.colors.grey(12), | ||
) = GroupHeaderColors(divider) | ||
|
||
@Composable | ||
fun GroupHeaderColors.Companion.dark( | ||
divider: Color = IntUiDarkTheme.colors.grey(3), | ||
) = GroupHeaderColors(divider) | ||
|
||
fun GroupHeaderMetrics.Companion.defaults( | ||
dividerThickness: Dp = 1.dp, | ||
indent: Dp = 8.dp, | ||
) = GroupHeaderMetrics(dividerThickness, indent) |