Skip to content

Commit

Permalink
Update sample row.
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebRas committed Jul 19, 2023
1 parent a9ef1a9 commit 8691667
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions Shared/Supporting Files/Views/SampleListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,38 @@ private extension SampleListView {
@State private var isShowingDescription = false

var body: some View {
NavigationLink {
SampleDetailView(sample: sample)
} label: {
HStack {
VStack(alignment: .leading, spacing: 5) {
ZStack {
NavigationLink {
SampleDetailView(sample: sample)
} label: {
EmptyView()
}
.frame(width: 0)
.opacity(0)

VStack(alignment: .leading, spacing: 5) {
HStack {
Text(sample.name)
if isShowingDescription {
Spacer()
Button {
isShowingDescription.toggle()
} label: {
Image(systemName: "chevron.right.circle")
.rotationEffect(isShowingDescription ? .degrees(90) : .zero)
}
.buttonStyle(.borderless)
}

if isShowingDescription {
Group {
Text("Category: \(sample.category)")
.bold()
Text(sample.description)
.font(.caption)
.foregroundColor(.secondary)
.transition(.move(edge: .top).combined(with: .opacity))
}
.font(.caption)
.transition(.move(edge: .top).combined(with: .opacity))
}
Spacer()
Button {
isShowingDescription.toggle()
} label: {
Image(systemName: isShowingDescription ? "info.circle.fill" : "info.circle")
}
.buttonStyle(.borderless)
}
.animation(.easeOut(duration: 0.2), value: isShowingDescription)
}
Expand Down

0 comments on commit 8691667

Please sign in to comment.