Skip to content

Commit 3e3d08a

Browse files
Merge pull request #7 from GitWither/transcript-dropdown
2 parents d326c8f + 06ca04a commit 3e3d08a

2 files changed

Lines changed: 74 additions & 1 deletion

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import Foundation
2+
import SwiftUI
3+
4+
struct TranscriptDropdownButton: View {
5+
let transcriptText: String
6+
7+
@State private var isCollapsed: Bool = true
8+
9+
init(transcriptText: String) {
10+
self.transcriptText = transcriptText
11+
}
12+
13+
var body: some View {
14+
HStack(alignment: .top, spacing: 12) {
15+
Image(systemName: isCollapsed ? "chevron.down" : "chevron.up")
16+
.font(.system(size: 16, weight: .bold))
17+
18+
19+
VStack(alignment: .leading) {
20+
Text("Transcript")
21+
.font(UIConstants.Typography.cardTitle)
22+
.foregroundColor(UIConstants.Colors.textPrimary)
23+
24+
VStack {
25+
26+
if !isCollapsed {
27+
Text(transcriptText)
28+
}
29+
}
30+
}
31+
32+
Spacer()
33+
34+
}
35+
.frame(alignment: .topLeading)
36+
.padding(.horizontal, UIConstants.Spacing.cardPadding + 4)
37+
.padding(.vertical, UIConstants.Spacing.cardPadding)
38+
.background(
39+
RoundedRectangle(cornerRadius: 20)
40+
.fill(UIConstants.Colors.cardSecondaryBackground)
41+
.overlay(
42+
RoundedRectangle(cornerRadius: 20)
43+
.stroke(
44+
UIConstants.Gradients.standardBorder,
45+
lineWidth: 1
46+
)
47+
)
48+
)
49+
.onTapGesture {
50+
withAnimation(.easeInOut(duration: 0.25)) {
51+
isCollapsed.toggle()
52+
}
53+
}
54+
}
55+
}
56+
57+
#Preview {
58+
GeometryReader { geometry in
59+
VStack(spacing: 16) {
60+
TranscriptDropdownButton(
61+
transcriptText: "Lorem ipsum dolor sit amet"
62+
)
63+
}
64+
.padding(20)
65+
}
66+
.frame(width: 500, height: 300)
67+
.background(UIConstants.Gradients.backgroundGradient)
68+
}

Recap/UseCases/Summary/SummaryView.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,14 @@ struct SummaryView<ViewModel: SummaryViewModelType>: View {
148148
ScrollView {
149149
VStack(alignment: .leading, spacing: UIConstants.Spacing.cardSpacing) {
150150
if let recording = viewModel.currentRecording,
151-
let summaryText = recording.summaryText {
151+
let summaryText = recording.summaryText,
152+
let transcriptionText = recording.transcriptionText {
152153

153154
VStack(alignment: .leading, spacing: UIConstants.Spacing.cardInternalSpacing) {
155+
if !transcriptionText.isEmpty {
156+
TranscriptDropdownButton(transcriptText: transcriptionText)
157+
}
158+
154159
Text("Summary")
155160
.font(UIConstants.Typography.infoCardTitle)
156161
.foregroundColor(UIConstants.Colors.textPrimary)

0 commit comments

Comments
 (0)