| 1 | import SwiftUI |
| 2 | |
| 3 | struct GuideArtworkView: View { |
| 4 | let entry: GuideEntry |
| 5 | var height: CGFloat = 160 |
| 6 | |
| 7 | var body: some View { |
| 8 | ZStack(alignment: .bottomLeading) { |
| 9 | RoundedRectangle(cornerRadius: 22, style: .continuous) |
| 10 | .fill( |
| 11 | LinearGradient( |
| 12 | colors: gradientColors, |
| 13 | startPoint: .topLeading, |
| 14 | endPoint: .bottomTrailing |
| 15 | ) |
| 16 | ) |
| 17 | |
| 18 | Circle() |
| 19 | .fill(Color.white.opacity(0.16)) |
| 20 | .frame(width: height * 0.9, height: height * 0.9) |
| 21 | .offset(x: height * 0.2, y: -height * 0.15) |
| 22 | |
| 23 | Image(systemName: entry.kind.symbolName) |
| 24 | .font(.system(size: height * 0.38, weight: .regular)) |
| 25 | .foregroundStyle(.white.opacity(0.85)) |
| 26 | .offset(x: -10, y: -6) |
| 27 | |
| 28 | VStack(alignment: .leading, spacing: 8) { |
| 29 | Text(entry.title) |
| 30 | .font(KleponTypography.cardTitle) |
| 31 | .foregroundStyle(.white) |
| 32 | |
| 33 | Text(entry.subtitle) |
| 34 | .font(KleponTypography.caption) |
| 35 | .foregroundStyle(.white.opacity(0.88)) |
| 36 | .lineLimit(2) |
| 37 | } |
| 38 | .padding(18) |
| 39 | } |
| 40 | .frame(maxWidth: .infinity) |
| 41 | .frame(height: height) |
| 42 | .clipShape(RoundedRectangle(cornerRadius: 22, style: .continuous)) |
| 43 | } |
| 44 | |
| 45 | private var gradientColors: [Color] { |
| 46 | switch entry.kind { |
| 47 | case .dish: |
| 48 | return [KleponColor.accentWarm, KleponColor.highlight] |
| 49 | case .ingredient: |
| 50 | return [KleponColor.accent, KleponColor.accentWarm] |
| 51 | case .tradition: |
| 52 | return [KleponColor.accent, KleponColor.highlight] |
| 53 | } |
| 54 | } |
| 55 | } |