-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Design] 태그뷰 디자인하기 #470
base: develop
Are you sure you want to change the base?
[Design] 태그뷰 디자인하기 #470
Changes from all commits
c8c935b
a55bcb5
f2950c1
2b93b4b
db66410
69226ff
bb2f3ab
b7275de
b44aee7
43668d7
080f551
2b4bdc0
68c65cf
ed6c433
bdfa55c
df81395
01b678b
833e753
58d7941
091334b
523f8f0
7622f06
258df59
21d2912
ad11f96
840f41d
958bd19
ee052d8
83bfc20
e639169
928b920
5645648
0a43815
c61ca50
63d187a
7cbfd78
97d31ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// CustomAlert.swift | ||
// Reazy | ||
// | ||
// Created by 김예림 on 3/6/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct CustomAlert: View { | ||
let mainText: String | ||
let message: String | ||
|
||
let cancleAction: () -> Void | ||
let confirmAction: () -> Void | ||
|
||
var body: some View { | ||
VStack(spacing: 0) { | ||
VStack(alignment: .center, spacing: 0) { | ||
Text(mainText) | ||
.reazyFont(.button1) | ||
.foregroundStyle(.gray900) | ||
.multilineTextAlignment(.center) | ||
Text(message) | ||
.reazyFont(.body1) | ||
.foregroundStyle(.gray900) | ||
.lineLimit(1) | ||
} | ||
.padding(.top, 25) | ||
.padding(.horizontal, 30) | ||
Spacer() | ||
|
||
Rectangle() | ||
.frame(height: 1) | ||
.foregroundStyle(.gray400) | ||
|
||
HStack(spacing: 70) { | ||
Button { | ||
cancleAction() | ||
} label: { | ||
Text("취소") | ||
.reazyFont(.text1) | ||
} | ||
Rectangle() | ||
.frame(width: 1) | ||
.foregroundStyle(.gray400) | ||
Button { | ||
confirmAction() | ||
} label: { | ||
Text("삭제") | ||
.reazyFont(.text1) | ||
.foregroundStyle(.pen1) | ||
} | ||
} | ||
.frame(height: 52) | ||
} | ||
.frame(width: 350, height: 176) | ||
.background( | ||
RoundedRectangle(cornerRadius: 20) | ||
.foregroundStyle(.gray200) | ||
) | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// Component.swift | ||
// Reazy | ||
// | ||
// Created by 김예림 on 2/17/25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct EllipsisView: View { | ||
let ellipsisAction: () -> Void | ||
|
||
var body: some View { | ||
VStack { | ||
Spacer() | ||
|
||
Button { | ||
ellipsisAction() | ||
} label: { | ||
Image(systemName: "ellipsis.circle") | ||
.font(.system(size: 24)) | ||
.foregroundStyle(.gray550) | ||
} | ||
.padding(.trailing, 24) | ||
.padding(.bottom, 20) | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,14 @@ import Foundation | |
protocol DynamicCell: Hashable, Identifiable { | ||
var id: UUID { get } | ||
var name: String { get } | ||
var isSeleted: Bool { get set } | ||
|
||
func getCellWidth() -> CGFloat | ||
} | ||
|
||
extension DynamicCell { | ||
func itemWidth(isEditMode: Bool) -> CGFloat { | ||
let padding: CGFloat = isEditMode ? 35 : 16 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DynamicCellLayout에서 셀의 너비를 계산하는 과정에서 셀 안의 패딩 값 계산이 빠져있더라구요. |
||
return getCellWidth() + padding | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// TagViewUseCase.swift | ||
// Reazy | ||
// | ||
// Created by 김예림 on 2/17/25. | ||
// | ||
|
||
import Foundation | ||
|
||
//MARK: - TODO : - 코어데이터 연결 | ||
protocol TagViewUseCase { | ||
func deleteTag(id: UUID, from tags: inout [Tag]) | ||
func createTag(name: String, in tags: inout [Tag]) | ||
} | ||
|
||
class DefaultTagViewUseCase: TagViewUseCase { | ||
func deleteTag(id: UUID, from tags: inout [Tag]) { | ||
tags.removeAll { $0.id == id } | ||
} | ||
|
||
func createTag(name: String, in tags: inout [Tag]) { | ||
tags.append(Tag(name: name)) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,24 +9,45 @@ import SwiftUI | |
|
||
|
||
struct PDFTagCell<Tag: DynamicCell>: View { | ||
let tag: Tag | ||
@State private var isAlertPresented: Bool = false | ||
let isMultiSelectable: Bool // 멀티선택 가능 여부 | ||
let isEditMode: Bool // 편집 가능 여부 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isMultiSelectable : 태그셀을 멀티 선택이 가능한지 구분해 searchView와 tagView에서의 셀 기능을 구별해두었어요. isEditMode : 위와 마찬가지로 태그를 편집(=삭제) 가능 여부를 구분합니다 |
||
|
||
var tag: Tag | ||
|
||
let action: () -> Void | ||
let selectAction: () -> Void | ||
let deleteAction: () -> Void | ||
Comment on lines
+18
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 원래는 action 하나만 있었는데, |
||
|
||
var body: some View { | ||
Button { | ||
action() | ||
if !isEditMode { | ||
selectAction() | ||
} | ||
} label: { | ||
// TODO: 태그 title | ||
Text(tag.name) | ||
.reazyFont(.h3) | ||
.foregroundStyle(.gray800) | ||
.frame(height: 24) | ||
.padding(.horizontal, 8) | ||
.background { | ||
RoundedRectangle(cornerRadius: 4) | ||
.foregroundStyle(.primary3) | ||
HStack(spacing: 0) { | ||
Text(tag.name) | ||
.reazyFont(isMultiSelectable ? .body1 : .h3) | ||
.foregroundStyle(tag.isSeleted ? .gray300 : .gray800) | ||
.fixedSize(horizontal: true, vertical: false) | ||
|
||
// 삭제 버튼 | ||
if isEditMode { | ||
Button { | ||
deleteAction() | ||
} label: { | ||
Image(systemName: "x.circle.fill") | ||
.foregroundStyle(.gray700) | ||
.font(.system(size: 12)) | ||
} | ||
} | ||
} | ||
.frame(height: 24) | ||
.padding(.horizontal, 8) | ||
.background { | ||
RoundedRectangle(cornerRadius: 4) | ||
.foregroundStyle(tag.isSeleted ? .point4 : .primary3) | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
screenWidth
: 이건 무니가UIScreen.main.bounds.width
값을 디폴트로 설정해 두었는데, 제가 활용하려는 뷰에서는 조정이 필요해서 넣었어요!