Login and Home
This commit is contained in:
101
pedi-foods/Sources/PediFoods/DesignSystem/DesignSystem.swift
Normal file
101
pedi-foods/Sources/PediFoods/DesignSystem/DesignSystem.swift
Normal file
@@ -0,0 +1,101 @@
|
||||
import SwiftUI
|
||||
|
||||
// MARK: - Colors
|
||||
|
||||
enum AppColors {
|
||||
static let primary = Color(hex: "#1E6B43")
|
||||
static let secondary = Color(hex: "#2F7C4B")
|
||||
static let tertiary = Color(hex: "#8CFF2E")
|
||||
|
||||
static let brandDark = Color(hex: "#1B5C3A")
|
||||
static let brandSoft = Color(hex: "#E8F2EC")
|
||||
|
||||
static let backgroundLight = Color(hex: "#F3F5F7")
|
||||
static let backgroundDark = Color(hex: "#18230F")
|
||||
static let surface = Color(hex: "#FFFFFF")
|
||||
static let textPrimary = Color(hex: "#1C1F23")
|
||||
static let textInverse = Color(hex: "#FFFFFF")
|
||||
static let textMuted = Color(hex: "#7B8794")
|
||||
}
|
||||
|
||||
enum AppDarkColors {
|
||||
static let background = Color(hex: "#18230F")
|
||||
static let surface = Color(hex: "#FFFFFF", alpha: 0.05)
|
||||
static let textPrimary = Color(hex: "#FFFFFF")
|
||||
static let textSecondary = Color(hex: "#A3A3A3")
|
||||
static let primary = AppColors.primary
|
||||
static let secondary = AppColors.secondary
|
||||
static let tertiary = AppColors.tertiary
|
||||
}
|
||||
|
||||
// MARK: - Typography
|
||||
|
||||
enum AppTypography {
|
||||
static let fontFamily = "Plus Jakarta Sans"
|
||||
|
||||
static let heading1 = Font.custom(fontFamily, size: 28).weight(.heavy)
|
||||
static let heading2 = Font.custom(fontFamily, size: 20).weight(.heavy)
|
||||
static let heading3 = Font.custom(fontFamily, size: 16).weight(.bold)
|
||||
static let body = Font.custom(fontFamily, size: 16).weight(.regular)
|
||||
static let button = Font.custom(fontFamily, size: 14).weight(.heavy)
|
||||
static let caption = Font.custom(fontFamily, size: 10).weight(.bold)
|
||||
static let overline = Font.custom(fontFamily, size: 11).weight(.bold)
|
||||
|
||||
static let bodyLineHeight: CGFloat = 1.6
|
||||
static let buttonLetterSpacing: CGFloat = 0.08
|
||||
static let captionLetterSpacing: CGFloat = 0.12
|
||||
}
|
||||
|
||||
// MARK: - Layout
|
||||
|
||||
enum AppLayout {
|
||||
static let radiusMD: CGFloat = 12
|
||||
static let radiusLG: CGFloat = 16
|
||||
static let radiusXL: CGFloat = 24
|
||||
static let radiusFull: CGFloat = 9999
|
||||
|
||||
static let spacing: [CGFloat] = [4, 8, 12, 16, 24, 32]
|
||||
}
|
||||
|
||||
// MARK: - Shadow
|
||||
|
||||
struct ShadowSpec {
|
||||
let color: Color
|
||||
let radius: CGFloat
|
||||
let y: CGFloat
|
||||
}
|
||||
|
||||
enum AppShadow {
|
||||
static let soft = ShadowSpec(color: Color.black.opacity(0.08), radius: 20, y: 6)
|
||||
static let glow = ShadowSpec(color: AppColors.tertiary.opacity(0.2), radius: 24, y: 8)
|
||||
}
|
||||
|
||||
// MARK: - Helpers
|
||||
|
||||
extension Color {
|
||||
init(hex: String, alpha: Double = 1.0) {
|
||||
let cleaned = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
|
||||
var int: UInt64 = 0
|
||||
Scanner(string: cleaned).scanHexInt64(&int)
|
||||
|
||||
let r, g, b: UInt64
|
||||
switch cleaned.count {
|
||||
case 6: // RRGGBB
|
||||
r = (int >> 16) & 0xFF
|
||||
g = (int >> 8) & 0xFF
|
||||
b = int & 0xFF
|
||||
case 3: // RGB
|
||||
r = ((int >> 8) & 0xF) * 17
|
||||
g = ((int >> 4) & 0xF) * 17
|
||||
b = (int & 0xF) * 17
|
||||
default:
|
||||
r = 0; g = 0; b = 0
|
||||
}
|
||||
|
||||
self.init(.sRGB,
|
||||
red: Double(r) / 255,
|
||||
green: Double(g) / 255,
|
||||
blue: Double(b) / 255,
|
||||
opacity: alpha)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user