diff --git a/WorldBuilder/Components/WorldCardView.swift b/WorldBuilder/Components/WorldCardView.swift new file mode 100644 index 0000000..43436e7 --- /dev/null +++ b/WorldBuilder/Components/WorldCardView.swift @@ -0,0 +1,19 @@ +// +// WorldCardView.swift +// WorldBuilder +// +// Created by Giovanni Josserand on 03/09/2026. +// + +import SwiftUI + +struct WorldCardView : View { + var world : World + + var body : some View { + VStack { + Text(world.name) + } + .background(.red) + } +} diff --git a/WorldBuilder/Views/WorldList/WorldListView.swift b/WorldBuilder/Views/WorldList/WorldListView.swift index 17b8ce8..a413493 100644 --- a/WorldBuilder/Views/WorldList/WorldListView.swift +++ b/WorldBuilder/Views/WorldList/WorldListView.swift @@ -12,25 +12,28 @@ struct WorldListView: View { @Environment(\.modelContext) private var context @Query(sort: \World.createdAt, order: .reverse) private var worlds: [World] + let columns = [GridItem(.flexible()), GridItem(.flexible())] var body: some View { - VStack(alignment: .leading, spacing: 24){ - WorldListHeaderView(worlds: worlds) - - if worlds.isEmpty { - EmptyWorldView() - }else{ - ScrollView { - List { + ScrollView { + VStack(alignment: .leading, spacing: 24){ + WorldListHeaderView(worlds: worlds) + + if worlds.isEmpty { + EmptyWorldView() + }else{ + LazyVGrid(columns: columns){ ForEach(worlds) {world in - NavigationLink(world.name){ + NavigationLink{ WorldOverviewView() + } label: { + WorldCardView(world: world) } } } } } + .frame(maxHeight: .infinity, alignment: .topLeading) } - .frame(maxHeight: .infinity, alignment: .topLeading) } }