mirror of
https://github.com/yattee/yattee.git
synced 2025-04-28 07:50:33 +05:30
make description collapsible
This commit is contained in:
parent
e78f40c555
commit
a57645f824
@ -21,19 +21,7 @@ struct VideoDescription: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Group {
|
descriptionView.id(video.videoID)
|
||||||
if !expandVideoDescription && !expand {
|
|
||||||
Button {
|
|
||||||
expand = true
|
|
||||||
} label: {
|
|
||||||
descriptionView
|
|
||||||
}
|
|
||||||
.buttonStyle(.plain)
|
|
||||||
} else {
|
|
||||||
descriptionView
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.id(video.videoID)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var descriptionView: some View {
|
var descriptionView: some View {
|
||||||
@ -54,7 +42,7 @@ struct VideoDescription: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var shouldExpand: Bool {
|
var shouldExpand: Bool {
|
||||||
expandVideoDescription || expand
|
expand
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder var textDescription: some View {
|
@ViewBuilder var textDescription: some View {
|
||||||
|
@ -243,6 +243,9 @@ struct VideoDetails: View {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.background(colorScheme == .dark ? Color.black : .white)
|
.background(colorScheme == .dark ? Color.black : .white)
|
||||||
|
.onAppear {
|
||||||
|
descriptionExpanded = expandVideoDescription
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@ -409,11 +412,11 @@ struct VideoDetails: View {
|
|||||||
var descriptionHeader: some View {
|
var descriptionHeader: some View {
|
||||||
HStack {
|
HStack {
|
||||||
Text("Description".localized())
|
Text("Description".localized())
|
||||||
|
Spacer()
|
||||||
if !expandVideoDescription, !descriptionExpanded {
|
Button { descriptionExpanded.toggle()
|
||||||
Spacer()
|
} label: {
|
||||||
Image(systemName: "arrow.up.and.down")
|
Image(systemName: descriptionExpanded ? "chevron.up" : "chevron.down")
|
||||||
.imageScale(.small)
|
.imageScale(.small)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.horizontal)
|
.padding(.horizontal)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user