From 188f56c7118540d07e99876d14185fa90bb6bbef Mon Sep 17 00:00:00 2001 From: insub Date: Tue, 3 Oct 2023 19:36:31 +0900 Subject: [PATCH] =?UTF-8?q?[Fix,=20Refactor]=20SessionDetail=20-=20Width?= =?UTF-8?q?=20=EA=B0=92=20=EA=B3=84=EC=82=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsyncSwift/Views/SessionView.swift | 59 ++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/AsyncSwift/Views/SessionView.swift b/AsyncSwift/Views/SessionView.swift index 960ac68..05c78e7 100644 --- a/AsyncSwift/Views/SessionView.swift +++ b/AsyncSwift/Views/SessionView.swift @@ -14,41 +14,40 @@ struct SessionView: View { let speakerImageSize: CGFloat = 80 var body: some View { - ZStack { - ScrollView { - Group { - customDivider - .padding(.top, 10) - .padding(.bottom, 4) - sessionDetail - } - .background(.white) - speakerDetail + ScrollView { + Group { + customDivider + .padding(.top, 10) + .padding(.bottom, 4) + sessionDetail } - .navigationTitle("Session") + .background(.white) + speakerDetail } + .navigationTitle("Session") } } private extension SessionView { var sessionDetail: some View { - HStack(spacing: 0) { - VStack(alignment: .leading, spacing: 0) { + VStack(alignment: .leading, spacing: 0) { + HStack { Text(session.title) .font(.title3) .fontWeight(.semibold) .padding(.vertical, 24) - VStack(alignment: .leading, spacing: 8) { - ForEach(session.description, id: \.self) { paragraph in - Text(paragraph.content) - } + Spacer(minLength: 0) + } + .background(Color.white) + VStack(alignment: .leading, spacing: 8) { + ForEach(session.description, id: \.self) { paragraph in + Text(paragraph.content) } - .padding(.bottom, 80) } - .padding(.horizontal, 24) - Spacer() + .padding(.bottom, 80) } + .frame(width: UIScreen.main.bounds.width - 32) } var speakerDetail: some View { @@ -87,3 +86,23 @@ private extension SessionView { .background(Color.speakerBackground) } } + +struct SessionView_Previews: PreviewProvider { + static var previews: some View { + SessionView( + session: .init( + id: 0, + title: "[Event] 사이드 프로젝트가 메인 JOB이 되기까지의 이야기", + description: [ + .init(content: "사이드 프로젝트가 메인 JOB이 되기까지 이야기") + ], + speaker: .init( + name: "박성은", + imageURL: "", + role: "북적 스튜디오 | iOS Developer", + description: "iOS 개발자 입니다." + ) + ) + ) + } +}