grtsinry43 f67fba3a85
Some checks failed
KMP Build & Package / Build Linux Native on ubuntu-latest (push) Has been cancelled
KMP Build & Package / Build macOS Native on macos-latest (push) Has been cancelled
KMP Build & Package / Build Windows Native on windows-latest (push) Has been cancelled
feat: Rename project from Activity Analyzer to Chronosight and update related resources
2025-05-19 15:17:49 +08:00

81 lines
2.4 KiB
Kotlin

package com.grtsinry43.chronosight.components
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Star
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import com.grtsinry43.chronosight.theme.AppThemes
import org.jetbrains.compose.ui.tooling.preview.Preview
@Composable
fun MetricCard(
title: String,
value: String,
icon: ImageVector,
colors: AppThemes.Colors,
modifier: Modifier = Modifier
) {
StyledCard(colors = colors, modifier = modifier) {
Column(
modifier = Modifier.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(6.dp) // Tighter spacing for mobile
) {
Icon(
imageVector = icon,
contentDescription = title,
tint = colors.accent,
modifier = Modifier.size(28.dp)
)
Text(
text = title,
style = MaterialTheme.typography.labelMedium.copy(color = colors.secondaryText),
textAlign = TextAlign.Center
)
Text(
text = value,
style = MaterialTheme.typography.titleMedium.copy(
color = colors.onSurface,
fontWeight = FontWeight.Bold
),
textAlign = TextAlign.Center
)
}
}
}
@Preview
@Composable
fun MetricCardPreview() {
MaterialTheme {
MetricCard(
title = "Total Users",
value = "1,234",
icon = Icons.Default.Star,
colors = AppThemes.LightThemeColors
)
}
}
@Preview
@Composable
fun MetricCardDarkPreview() {
MaterialTheme {
MetricCard(
title = "Active Sessions (Dark)",
value = "56",
icon = Icons.Default.Star, // Placeholder
colors = AppThemes.DarkThemeColors
)
}
}