krz/daybyday

clone: git clone https://gitbay.org/krz/daybyday.git

main: ColorsView.swift · raw

 1//
 2//  ColorsView.swift
 3//  DayByDay
 4//
 5
 6import SwiftUI
 7
 8/// Displays 10 colors as large, tappable cards in a scrollable grid.
 9/// Adapts between 1 and 2 columns depending on available width.
10struct ColorsView: View {
11    private let columns = [
12        GridItem(.adaptive(minimum: 300, maximum: 500), spacing: 24)
13    ]
14
15    var body: some View {
16        ScrollView {
17            LazyVGrid(columns: columns, spacing: 24) {
18                ForEach(LearnColor.allCases) { color in
19                    ColorCard(learnColor: color)
20                        .frame(height: 200)
21                }
22            }
23            .padding(32)
24        }
25    }
26}
27
28#Preview {
29    ColorsView()
30}