aboutsummaryrefslogtreecommitdiff
path: root/ui/compose
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2024-05-29 02:43:15 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2024-05-29 02:43:15 +0530
commitf60c20060db8922c710294396b6a4107b77abdc2 (patch)
tree5d0a2eaca7b8a3325e97ce933c0bfa17122e0435 /ui/compose
parent4939153e8150457c64d26ea76727f26880baf807 (diff)
refactor(ui): tokenize spacing
Diffstat (limited to 'ui/compose')
-rw-r--r--ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt6
-rw-r--r--ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt4
-rw-r--r--ui/compose/src/main/kotlin/app/passwordstore/ui/compose/theme/Spacing.kt9
3 files changed, 14 insertions, 5 deletions
diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt
index b832ab0f..942f8fc3 100644
--- a/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt
+++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/APSAppBar.kt
@@ -18,10 +18,10 @@ import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.graphics.vector.rememberVectorPainter
-import androidx.compose.ui.unit.dp
import app.passwordstore.ui.compose.preview.DevicePreviews
import app.passwordstore.ui.compose.preview.ThemePreviews
import app.passwordstore.ui.compose.theme.APSTheme
+import app.passwordstore.ui.compose.theme.SpacingMedium
@SuppressLint("ComposableLambdaParameterNaming") // The lint doesn't really apply to `actions`
@Composable
@@ -39,13 +39,13 @@ public fun APSAppBar(
navigationIcon = {
if (navigationIcon != null) {
IconButton(onClick = onNavigationIconClick) {
- Icon(painter = navigationIcon, contentDescription = null)
+ Icon(painter = navigationIcon, contentDescription = "Back navigation button")
}
}
},
actions = actions,
colors = TopAppBarDefaults.topAppBarColors(containerColor = backgroundColor),
- modifier = modifier.shadow(8.dp),
+ modifier = modifier.shadow(SpacingMedium),
)
}
diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt
index 01b42093..d79bbb61 100644
--- a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt
+++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/PasswordItem.kt
@@ -19,10 +19,10 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.rememberVectorPainter
-import androidx.compose.ui.unit.dp
import app.passwordstore.ui.compose.preview.DevicePreviews
import app.passwordstore.ui.compose.preview.ThemePreviews
import app.passwordstore.ui.compose.theme.APSTheme
+import app.passwordstore.ui.compose.theme.SpacingLarge
public enum class ItemType {
File,
@@ -42,7 +42,7 @@ public fun PasswordItem(
.clickable(enabled = true, onClick = onClick)
.background(MaterialTheme.colorScheme.background)
.minimumInteractiveComponentSize()
- .padding(horizontal = 16.dp)
+ .padding(horizontal = SpacingLarge)
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically,
diff --git a/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/theme/Spacing.kt b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/theme/Spacing.kt
new file mode 100644
index 00000000..0e8a60e9
--- /dev/null
+++ b/ui/compose/src/main/kotlin/app/passwordstore/ui/compose/theme/Spacing.kt
@@ -0,0 +1,9 @@
+package app.passwordstore.ui.compose.theme
+
+import androidx.compose.ui.unit.Dp
+import androidx.compose.ui.unit.dp
+
+public val SpacingSmall: Dp = 4.dp
+public val SpacingMedium: Dp = 8.dp
+public val SpacingLarge: Dp = 16.dp
+public val SpacingLargest: Dp = 24.dp