-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling material colors & previews
- Loading branch information
1 parent
a98b5af
commit 60c88e2
Showing
10 changed files
with
208 additions
and
47 deletions.
There are no files selected for viewing
7 changes: 0 additions & 7 deletions
7
concrete/src/main/kotlin/glass/yasan/concrete/component/SpacerVertical.kt
This file was deleted.
Oops, something went wrong.
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
40 changes: 40 additions & 0 deletions
40
concrete/src/main/kotlin/glass/yasan/concrete/component/internal/Preview.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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package glass.yasan.concrete.component.internal | ||
|
||
import android.content.res.Configuration | ||
import androidx.compose.foundation.isSystemInDarkTheme | ||
import androidx.compose.material3.Surface | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import glass.yasan.concrete.theme.ConcreteTheme | ||
import glass.yasan.concrete.theme.color.darkColors | ||
import glass.yasan.concrete.theme.color.lightColors | ||
|
||
@Composable | ||
internal fun PreviewTheme( | ||
modifier: Modifier = Modifier, | ||
content: @Composable () -> Unit, | ||
) { | ||
val colors = when (!isSystemInDarkTheme()) { | ||
true -> lightColors() | ||
false -> darkColors() | ||
} | ||
ConcreteTheme(colors = colors) { | ||
Surface( | ||
modifier = modifier, | ||
) { | ||
content() | ||
} | ||
} | ||
} | ||
|
||
@Preview( | ||
name = "Light", | ||
group = "light-mode", | ||
) | ||
@Preview( | ||
name = "Dark", | ||
group = "dark-mode", | ||
uiMode = Configuration.UI_MODE_NIGHT_YES, | ||
) | ||
internal annotation class ConcretePreviews |
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
Oops, something went wrong.