-
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.
Refactor component styling API for extension components (#210)
* Refactor component styling API for extension components * Make detekt happy * Make detekt happy
- Loading branch information
Showing
8 changed files
with
62 additions
and
23 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
19 changes: 10 additions & 9 deletions
19
...ui/int-ui-decorated-window/src/main/kotlin/org/jetbrains/jewel/intui/window/IntUiTheme.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,28 +1,29 @@ | ||
package org.jetbrains.jewel.intui.window | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.ProvidedValue | ||
import org.jetbrains.jewel.foundation.theme.ThemeDefinition | ||
import org.jetbrains.jewel.intui.window.styling.dark | ||
import org.jetbrains.jewel.intui.window.styling.light | ||
import org.jetbrains.jewel.ui.theme.ComponentStyleProviderScope | ||
import org.jetbrains.jewel.window.styling.DecoratedWindowStyle | ||
import org.jetbrains.jewel.window.styling.LocalDecoratedWindowStyle | ||
import org.jetbrains.jewel.window.styling.LocalTitleBarStyle | ||
import org.jetbrains.jewel.window.styling.TitleBarStyle | ||
|
||
@Composable | ||
fun ThemeDefinition.decoratedWindowComponentStyling( | ||
windowStyle: DecoratedWindowStyle = if (isDark) { | ||
fun ComponentStyleProviderScope.provideDecoratedWindowComponentStyling( | ||
windowStyle: DecoratedWindowStyle = if (theme.isDark) { | ||
DecoratedWindowStyle.dark() | ||
} else { | ||
DecoratedWindowStyle.light() | ||
}, | ||
titleBarStyle: TitleBarStyle = if (isDark) { | ||
titleBarStyle: TitleBarStyle = if (theme.isDark) { | ||
TitleBarStyle.dark() | ||
} else { | ||
TitleBarStyle.light() | ||
}, | ||
): Array<ProvidedValue<*>> = arrayOf( | ||
LocalDecoratedWindowStyle provides windowStyle, | ||
LocalTitleBarStyle provides titleBarStyle, | ||
) | ||
) { | ||
provide( | ||
LocalDecoratedWindowStyle provides windowStyle, | ||
LocalTitleBarStyle provides titleBarStyle, | ||
) | ||
} |
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