Skip to content

Commit

Permalink
Refactor code to meet pipeline formatting and linting standards.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigomatosc committed Aug 26, 2024
1 parent a3013de commit 1c24822
Showing 1 changed file with 38 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,37 +252,9 @@ private fun CategoryCard(
val contrastColor = findContrastTextColor(categoryData.category.color.value.toComposeColor())

if (!compactModeEnabled) {
Spacer(Modifier.height(10.dp))
Column(
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxWidth()
.clip(UI.shapes.r4)
.border(2.dp, UI.colors.medium, UI.shapes.r4)
.clickable(
onClick = onClick
)
) {
CategoryHeader(
categoryData = categoryData,
currency = currency,
contrastColor = findContrastTextColor(categoryData.category.color.value.toComposeColor())
)

Spacer(Modifier.height(12.dp))

// Emitting content
AddedSpent(
currency = currency,
monthlyIncome = categoryData.monthlyIncome,
monthlyExpenses = categoryData.monthlyExpenses
)

Spacer(Modifier.height(12.dp))
}
}

if (compactModeEnabled) {
Spacer(Modifier.height(16.dp))
DefaultCategoryCard(onClick, categoryData, currency)
} else {
Spacer(Modifier.height(8.dp))
CompactCategoryCard(
categoryData = categoryData,
Expand All @@ -293,6 +265,41 @@ private fun CategoryCard(
}
}

@Composable
private fun DefaultCategoryCard(
onClick: () -> Unit,
categoryData: CategoryData,
currency: String
) {
Column(
modifier = Modifier
.padding(horizontal = 16.dp)
.fillMaxWidth()
.clip(UI.shapes.r4)
.border(2.dp, UI.colors.medium, UI.shapes.r4)
.clickable(
onClick = onClick
)
) {
CategoryHeader(
categoryData = categoryData,
currency = currency,
contrastColor = findContrastTextColor(categoryData.category.color.value.toComposeColor())
)

Spacer(Modifier.height(12.dp))

// Emitting content
AddedSpent(
currency = currency,
monthlyIncome = categoryData.monthlyIncome,
monthlyExpenses = categoryData.monthlyExpenses
)

Spacer(Modifier.height(12.dp))
}
}

@Composable
private fun CompactCategoryCard(
categoryData: CategoryData,
Expand Down

0 comments on commit 1c24822

Please sign in to comment.