Skip to content

Commit

Permalink
demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Usbergo committed Jun 5, 2020
1 parent 17b0f98 commit a6507c9
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions Demo/store_hacker_news/store_hacker_news/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}


}

0 comments on commit a6507c9

Please sign in to comment.