package com.craigvg.lichun_android.utils import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.shadow import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.craigvg.lichun_android.ui.theme.AppColors import com.craigvg.lichun_android.ui.theme.AppSpacing /** * Common Compose modifier chains * Ported from iOS View+Extensions.swift */ /** * Standard card style with elevation, rounded corners, and surface background. */ fun Modifier.cardStyle( cornerRadius: Dp = AppSpacing.cornerRadius, elevation: Dp = AppSpacing.cardElevation, backgroundColor: Color = AppColors.surfaceElevated ): Modifier = this .shadow(elevation = elevation, shape = RoundedCornerShape(cornerRadius)) .clip(RoundedCornerShape(cornerRadius)) .background(backgroundColor) /** * Glass-effect style with translucent background and subtle border. */ fun Modifier.glassEffect( cornerRadius: Dp = AppSpacing.cornerRadius, alpha: Float = 0.7f ): Modifier = this .clip(RoundedCornerShape(cornerRadius)) .background(AppColors.surfaceElevated.copy(alpha = alpha)) .border( width = 1.dp, color = Color.White.copy(alpha = 0.2f), shape = RoundedCornerShape(cornerRadius) ) /** * Pill-shaped modifier for tags and badges. */ fun Modifier.pillStyle( backgroundColor: Color = AppColors.primary.copy(alpha = 0.1f) ): Modifier = this .clip(RoundedCornerShape(AppSpacing.pillCornerRadius)) .background(backgroundColor) /** * Gradient background modifier. */ fun Modifier.gradientBackground( colors: List, cornerRadius: Dp = AppSpacing.cornerRadius ): Modifier = this .clip(RoundedCornerShape(cornerRadius)) .background(Brush.linearGradient(colors)) /** * Conditionally applies a modifier. */ inline fun Modifier.conditional( condition: Boolean, modifier: Modifier.() -> Modifier ): Modifier = if (condition) this.modifier() else this