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