Skip to content

Commit

Permalink
Merge pull request #211 from DeveloperAcademy-POSTECH/main
Browse files Browse the repository at this point in the history
[Release] v1.0.1 업데이트
  • Loading branch information
minjung0067 authored Nov 16, 2024
2 parents 2955fce + b8a933c commit 733f5cc
Show file tree
Hide file tree
Showing 18 changed files with 405 additions and 421 deletions.
143 changes: 75 additions & 68 deletions Project/Reazy/DesignSystem/Extensions/View+NavigationBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,81 +9,88 @@ import SwiftUI

// MARK: - 커스텀 Navigation Bar
struct CustomNavigationBarModifier<C, L, R>: ViewModifier where C : View, L : View, R : View {
let centerView: (() -> C)?
let leftView: (() -> L)?
let rightView: (() -> R)?

init(centerView: (() -> C)? = nil, leftView: (() -> L)? = nil, rightView: (() -> R)? = nil) {
self.centerView = centerView
self.leftView = leftView
self.rightView = rightView
}

func body(content: Content) -> some View {
VStack(spacing: 0) {
ZStack {
HStack {
self.leftView?()
Spacer()
self.rightView?()
}
.frame(height: 51)
.padding(.horizontal, 20)

HStack {
Spacer()
self.centerView?()
Spacer()
let centerView: (() -> C)?
let leftView: (() -> L)?
let rightView: (() -> R)?

init(centerView: (() -> C)? = nil, leftView: (() -> L)? = nil, rightView: (() -> R)? = nil) {
self.centerView = centerView
self.leftView = leftView
self.rightView = rightView
}

func body(content: Content) -> some View {
VStack(spacing: 0) {
ZStack {
HStack {
self.leftView?()
Spacer()
self.rightView?()
}
.frame(height: 51)
.padding(.horizontal, 20)

HStack {
Spacer()
self.centerView?()
Spacer()
}
}
.padding(.top, 10)
.background(.primary2)
.zIndex(1)

Rectangle()
.frame(height: 1)
.foregroundStyle(Color(hex: "CCCEE1"))
.zIndex(1)

content
.zIndex(0)
}
}
.padding(.top, 10)
.background(.primary2)

content
.navigationBarHidden(true)
}
.navigationBarHidden(true)
}
}

private struct WillDisappearModifier: ViewModifier {
let callback: () -> Void

func body(content: Content) -> some View {
content
.onDisappear {
callback()
}
}
let callback: () -> Void
func body(content: Content) -> some View {
content
.onDisappear {
callback()
}
}
}


extension View {
func onWillDisappear(_ perform: @escaping () -> Void) -> some View {
self.modifier(WillDisappearModifier(callback: perform))
}

func customNavigationBar<C, L, R> (
centerView: @escaping (() -> C),
leftView: @escaping (() -> L),
rightView: @escaping (() -> R)
) -> some View where C: View, L: View, R: View {
modifier(
CustomNavigationBarModifier(centerView: centerView, leftView: leftView, rightView: rightView)
)
}

func customNavigationBar<V> (
centerView: @escaping (() -> V)
) -> some View where V: View {
modifier(
CustomNavigationBarModifier(
centerView: centerView,
leftView: {
EmptyView()
}, rightView: {
EmptyView()
}
)
)
}
func onWillDisappear(_ perform: @escaping () -> Void) -> some View {
self.modifier(WillDisappearModifier(callback: perform))
}
func customNavigationBar<C, L, R> (
centerView: @escaping (() -> C),
leftView: @escaping (() -> L),
rightView: @escaping (() -> R)
) -> some View where C: View, L: View, R: View {
modifier(
CustomNavigationBarModifier(centerView: centerView, leftView: leftView, rightView: rightView)
)
}
func customNavigationBar<V> (
centerView: @escaping (() -> V)
) -> some View where V: View {
modifier(
CustomNavigationBarModifier(
centerView: centerView,
leftView: {
EmptyView()
}, rightView: {
EmptyView()
}
)
)
}
}
4 changes: 3 additions & 1 deletion Project/Reazy/DesignSystem/Views/SearchBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ struct SearchBar: View {
self.text = ""
}, label: {
Image(systemName: "xmark.circle.fill")

})
.id(text)
.transition(.opacity)
.animation(.easeInOut(duration: 0.2), value: text)
} else {
EmptyView()
}
Expand Down
45 changes: 33 additions & 12 deletions Project/Reazy/Views/Home/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -338,16 +338,14 @@ private struct RenamePaperTitleView: View {
}
} label: {
Image(systemName: "xmark")
.resizable()
.scaledToFit()
.frame(width: 17)
.font(.system(size: 18))
}
.foregroundStyle(.gray100)
.padding(28)

Spacer()

Button("완료") {
Button(action: {
if isEditingTitle {
pdfFileManager.updateTitle(at: paperInfo.id, title: text)
isEditingTitle = false
Expand All @@ -356,9 +354,16 @@ private struct RenamePaperTitleView: View {
self.pdfFileManager.memoText = text
isEditingMemo = false
}
}) {
RoundedRectangle(cornerRadius: 20)
.stroke(.gray100, lineWidth: 1)
.frame(width: 68, height: 36)
.overlay(
Text("완료")
.reazyFont(.button1)
.foregroundStyle(.gray100)
)
}
.reazyFont(.button1)
.foregroundStyle(.gray100)
.padding(28)
}

Expand All @@ -383,12 +388,28 @@ private struct RenamePaperTitleView: View {
}
.frame(width: 400, height: isEditingTitle ? 52 : 180)
.overlay(alignment: isEditingTitle ? .center : .topLeading) {
TextField( isEditingTitle ? "제목을 입력해주세요." : "내용을 입력해주세요.", text: $text, axis: .vertical)
.lineLimit( isEditingTitle ? 1 : 6)
.padding(.horizontal, 16)
.padding(.vertical, isEditingTitle ? 0 : 16)
.font(.custom(ReazyFontType.pretendardMediumFont, size: 16))
.foregroundStyle(.gray800)

if isEditingTitle {
TextField("제목을 입력해주세요.", text: $text)
.submitLabel(.done)
.onSubmit {
pdfFileManager.updateTitle(at: paperInfo.id, title: text)
isEditingTitle = false
}
.lineLimit( isEditingTitle ? 1 : 6)
.padding(.horizontal, 16)
.padding(.vertical, isEditingTitle ? 0 : 16)
.font(.custom(ReazyFontType.pretendardMediumFont, size: 16))
.foregroundStyle(.gray800)
} else {
TextField("내용을 입력해주세요.", text: $text, axis: .vertical)
.submitLabel(.return)
.lineLimit(6)
.padding(.horizontal, 16)
.padding(.vertical, 16)
.font(.custom(ReazyFontType.pretendardMediumFont, size: 16))
.foregroundStyle(.gray800)
}
}
.overlay(alignment: isEditingTitle ? .trailing : .bottomTrailing) {
if !self.text.isEmpty {
Expand Down
15 changes: 9 additions & 6 deletions Project/Reazy/Views/Home/Paper/PaperInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ struct PaperInfoView: View {
.scaledToFit()
.padding(.horizontal, 30)

Text(title)
.reazyFont(.text1)
.foregroundStyle(.gray900)
.padding(.horizontal, 30)
.padding(.top, 14)
.lineLimit(2)
HStack(spacing: 0) {
Text(title)
.reazyFont(.text1)
.foregroundStyle(.gray900)
.padding(.horizontal, 30)
.padding(.top, 14)
.lineLimit(2)
Spacer()
}

HStack(spacing: 0) {
Menu {
Expand Down
3 changes: 1 addition & 2 deletions Project/Reazy/Views/Home/Paper/PaperListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ struct PaperListView: View {

Button(action: {
isFavoritesSelected = true
// TODO: - 즐겨찾기 filter 적용 필요
}, label: {
Text("즐겨찾기")
.reazyFont(isFavoritesSelected ? .text3 : .h2)
Expand Down Expand Up @@ -97,7 +96,7 @@ struct PaperListView: View {
.scaledToFit()
.frame(height: 146)
.padding(.bottom, 11)
Text("새로운 논문을 가져와주세요")
Text(isFavoritesSelected ? "즐겨찾기한 논문이 없어요" : "새로운 논문을 가져와주세요")
.reazyFont(.h5)
.foregroundStyle(.gray550)
.padding(.bottom, 80)
Expand Down
Loading

0 comments on commit 733f5cc

Please sign in to comment.