diff --git a/Demo/store_hacker_news/store_hacker_news/ContentView.swift b/Demo/store_hacker_news/store_hacker_news/ContentView.swift index 9761535..15049d5 100644 --- a/Demo/store_hacker_news/store_hacker_news/ContentView.swift +++ b/Demo/store_hacker_news/store_hacker_news/ContentView.swift @@ -60,19 +60,36 @@ struct StoryView: View { } var body: some View { + Group { + if store.isSelected { + expanded + } else { + collapsed + } + }.padding() + } + + var collapsed: some View { Button(action: store.select) { - VStack(alignment: store.isSelected ? .center : .leading) { + VStack(alignment: .leading) { Text(title).font(.headline) - Text(caption).font(.subheadline).lineLimit(store.isSelected ? nil : 4) - - if store.isSelected { - Button(action: store.deselect) { - Image(systemName: "xmark.circle") - } - } + Text(caption).font(.subheadline).lineLimit(2) + } + } + } + + var expanded: some View { + VStack(alignment: .center) { + Text(title).font(.system(.headline, design: .rounded)) + ScrollView { + Text(caption).font(.callout) + } + Spacer() + Button(action: store.deselect) { + Image(systemName: "xmark.circle") } - .padding() } } + }