aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2024-05-28 00:35:44 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2024-05-28 00:35:44 +0530
commit1b936f623a3d89f84afb08d189458130399b9998 (patch)
treef06e90f86870dcb1d729c47f494e84c6bfa336cd /ui
parent3266a1b0333e43ff567e9d2c7fed85cd428e69d3 (diff)
feat(compose): add some multipreview annotations
Diffstat (limited to 'ui')
-rw-r--r--ui/compose/build.gradle.kts1
-rw-r--r--ui/compose/src/main/kotlin/app/passwordstore/ui/compose/preview/PreviewAnnotations.kt22
2 files changed, 23 insertions, 0 deletions
diff --git a/ui/compose/build.gradle.kts b/ui/compose/build.gradle.kts
index 8ede9ad3..7c321cfa 100644
--- a/ui/compose/build.gradle.kts
+++ b/ui/compose/build.gradle.kts
@@ -24,4 +24,5 @@ dependencies {
api(libs.compose.material3)
api(libs.compose.ui.core)
implementation(libs.androidx.core.ktx)
+ implementation(libs.compose.ui.tooling)
}
diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/preview/PreviewAnnotations.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/preview/PreviewAnnotations.kt
new file mode 100644
index 00000000..2bde764a
--- /dev/null
+++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/preview/PreviewAnnotations.kt
@@ -0,0 +1,22 @@
+package app.passwordstore.ui.compose.preview
+
+import android.content.res.Configuration
+import androidx.compose.ui.tooling.preview.Preview
+
+/**
+ * Multipreview annotation that represents light and dark themes. Add this annotation to a
+ * composable to render the both themes.
+ */
+@Preview(uiMode = Configuration.UI_MODE_NIGHT_NO, name = "Light theme")
+@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES, name = "Dark theme")
+public annotation class ThemePreviews
+
+/**
+ * Multipreview annotation that represents various device sizes. Add this annotation to a composable
+ * to render various devices.
+ */
+@Preview(name = "phone", device = "spec:shape=Normal,width=360,height=640,unit=dp,dpi=480")
+@Preview(name = "landscape", device = "spec:shape=Normal,width=640,height=360,unit=dp,dpi=480")
+@Preview(name = "foldable", device = "spec:shape=Normal,width=673,height=841,unit=dp,dpi=480")
+@Preview(name = "tablet", device = "spec:shape=Normal,width=1280,height=800,unit=dp,dpi=480")
+public annotation class DevicePreviews