From 6803f5c8d713f2faea5fa2825767bb0bb0fadf25 Mon Sep 17 00:00:00 2001 From: JH713 Date: Wed, 3 Apr 2024 23:49:46 +0900 Subject: [PATCH 1/3] feat: set folder name label trailing --- .../BoxList/EditFolder/EditFolderCell.swift | 19 +++++++++++++++---- iBox/Sources/BoxList/FolderButton.swift | 10 ++++++---- iBox/Sources/BoxList/FolderView.swift | 1 + 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/iBox/Sources/BoxList/EditFolder/EditFolderCell.swift b/iBox/Sources/BoxList/EditFolder/EditFolderCell.swift index 8631712..cef1110 100644 --- a/iBox/Sources/BoxList/EditFolder/EditFolderCell.swift +++ b/iBox/Sources/BoxList/EditFolder/EditFolderCell.swift @@ -13,6 +13,8 @@ class EditFolderCell: UITableViewCell { var onDelete: (() -> Void)? var onEdit: (() -> Void)? + private let containerView = UIView() + private let folderView = FolderView() private let editButton = UIButton().then{ @@ -53,16 +55,25 @@ class EditFolderCell: UITableViewCell { } private func setupHierarchy() { - contentView.addSubview(folderView) - folderView.addSubview(editButton) + contentView.addSubview(containerView) + containerView.addSubview(folderView) + containerView.addSubview(editButton) } private func setupLayout() { - folderView.snp.makeConstraints { make in + containerView.snp.makeConstraints { make in make.edges.equalToSuperview() } + editButton.snp.makeConstraints { make in - make.top.bottom.trailing.equalToSuperview() + make.top.bottom.equalToSuperview() + make.trailing.equalToSuperview().inset(10) + make.width.equalTo(30) + } + + folderView.snp.makeConstraints { make in + make.top.bottom.leading.equalToSuperview() + make.trailing.equalTo(editButton.snp.leading) } } diff --git a/iBox/Sources/BoxList/FolderButton.swift b/iBox/Sources/BoxList/FolderButton.swift index 19a0869..33e7013 100644 --- a/iBox/Sources/BoxList/FolderButton.swift +++ b/iBox/Sources/BoxList/FolderButton.swift @@ -50,14 +50,16 @@ class FolderButton: UIButton { } private func setupLayout() { - folderView.snp.makeConstraints { make in - make.edges.equalToSuperview() - } - openCloseImageView.snp.makeConstraints { make in make.centerY.equalToSuperview() + make.width.height.equalTo(20) make.trailing.equalToSuperview().offset(-20) } + + folderView.snp.makeConstraints { make in + make.top.bottom.leading.equalToSuperview() + make.trailing.equalTo(openCloseImageView.snp.leading) + } } func setFolderName(_ name: String) { diff --git a/iBox/Sources/BoxList/FolderView.swift b/iBox/Sources/BoxList/FolderView.swift index 72a43dc..755ade6 100644 --- a/iBox/Sources/BoxList/FolderView.swift +++ b/iBox/Sources/BoxList/FolderView.swift @@ -51,6 +51,7 @@ class FolderView: UIView { folderNameLabel.snp.makeConstraints { make in make.centerY.equalToSuperview() make.leading.equalTo(folderImageView.snp.trailing).offset(10) + make.trailing.equalToSuperview().inset(10) } } From 1fadba1789eeb88885576a25282cf26c9fdf14d3 Mon Sep 17 00:00:00 2001 From: JH713 Date: Wed, 3 Apr 2024 23:58:14 +0900 Subject: [PATCH 2/3] feat: set folder name label leading, trailing in addBookmarkView --- .../BoxList/AddBookmark/AddBookmarkView.swift | 2 +- .../BoxList/AddBookmark/FolderListCell.swift | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/iBox/Sources/BoxList/AddBookmark/AddBookmarkView.swift b/iBox/Sources/BoxList/AddBookmark/AddBookmarkView.swift index 8808a66..7298822 100644 --- a/iBox/Sources/BoxList/AddBookmark/AddBookmarkView.swift +++ b/iBox/Sources/BoxList/AddBookmark/AddBookmarkView.swift @@ -174,11 +174,11 @@ class AddBookmarkView: UIView { buttonLabel.snp.makeConstraints { make in make.leading.equalTo(button.snp.leading).offset(20) make.centerY.equalTo(button.snp.centerY) - make.width.equalTo(40) make.height.equalTo(40) } selectedFolderLabel.snp.makeConstraints { make in + make.leading.equalTo(buttonLabel.snp.trailing).offset(10) make.trailing.equalTo(chevronImageView.snp.leading).offset(-10) make.centerY.equalTo(button.snp.centerY) make.height.equalTo(40) diff --git a/iBox/Sources/BoxList/AddBookmark/FolderListCell.swift b/iBox/Sources/BoxList/AddBookmark/FolderListCell.swift index e77e200..2d8facf 100644 --- a/iBox/Sources/BoxList/AddBookmark/FolderListCell.swift +++ b/iBox/Sources/BoxList/AddBookmark/FolderListCell.swift @@ -65,19 +65,19 @@ class FolderListCell: UITableViewCell { make.bottom.lessThanOrEqualToSuperview().offset(-10) } + checkImageView.snp.makeConstraints { make in + make.centerY.equalToSuperview() + make.trailing.equalToSuperview().offset(-20) + make.width.height.equalTo(24) + } + folderNameLabel.snp.makeConstraints { make in make.centerY.equalToSuperview() make.leading.equalTo(folderImageView.snp.trailing).offset(10) - make.trailing.lessThanOrEqualToSuperview().offset(-20) + make.trailing.equalTo(checkImageView.snp.leading).offset(-10) make.top.greaterThanOrEqualToSuperview().offset(10) make.bottom.lessThanOrEqualToSuperview().offset(-10) } - - checkImageView.snp.makeConstraints { make in - make.centerY.equalToSuperview() - make.trailing.equalToSuperview().offset(-20) - make.width.height.equalTo(24) - } } func configureWith(folder: Folder, isSelected: Bool) { From d8ad6ecf2157b2ae0ecbfc4861c953a19859f1c9 Mon Sep 17 00:00:00 2001 From: JH713 Date: Thu, 4 Apr 2024 00:28:16 +0900 Subject: [PATCH 3/3] feat: set bookmark label trailing --- iBox/Sources/BoxList/BoxListCell.swift | 21 +++++++++++++++++-- iBox/Sources/BoxList/BoxListView.swift | 2 +- .../BoxList/EditFolder/EditFolderCell.swift | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/iBox/Sources/BoxList/BoxListCell.swift b/iBox/Sources/BoxList/BoxListCell.swift index aedaf8d..2daa2ef 100644 --- a/iBox/Sources/BoxList/BoxListCell.swift +++ b/iBox/Sources/BoxList/BoxListCell.swift @@ -85,11 +85,14 @@ class BoxListCell: UITableViewCell { } label.snp.makeConstraints { make in - make.top.trailing.bottom.equalToSuperview() + make.top.bottom.equalToSuperview() + make.trailing.equalToSuperview().inset(25) make.leading.equalTo(cellImageView.snp.trailing).offset(10) } editButton.snp.makeConstraints { make in - make.top.bottom.trailing.equalToSuperview() + make.width.equalTo(30) + make.top.bottom.equalToSuperview() + make.trailing.equalToSuperview().offset(-10) } } @@ -106,6 +109,20 @@ class BoxListCell: UITableViewCell { func setEditButtonHidden(_ isHidden: Bool) { editButton.isHidden = isHidden + + if isHidden { + label.snp.remakeConstraints { make in + make.top.bottom.equalToSuperview() + make.trailing.equalToSuperview().inset(25) + make.leading.equalTo(cellImageView.snp.trailing).offset(10) + } + } else { + label.snp.remakeConstraints { make in + make.top.bottom.equalToSuperview() + make.trailing.equalTo(editButton.snp.leading).offset(-5) + make.leading.equalTo(cellImageView.snp.trailing).offset(10) + } + } } } diff --git a/iBox/Sources/BoxList/BoxListView.swift b/iBox/Sources/BoxList/BoxListView.swift index a370098..2a99fe6 100644 --- a/iBox/Sources/BoxList/BoxListView.swift +++ b/iBox/Sources/BoxList/BoxListView.swift @@ -166,7 +166,7 @@ extension BoxListView: UITableViewDelegate { make.top.bottom.equalToSuperview() make.leading.trailing.equalToSuperview().inset(15) } - view.backgroundColor = .backgroundColor + view.backgroundColor = .tableViewBackgroundColor line.backgroundColor = .quaternaryLabel return view } diff --git a/iBox/Sources/BoxList/EditFolder/EditFolderCell.swift b/iBox/Sources/BoxList/EditFolder/EditFolderCell.swift index cef1110..1d5a169 100644 --- a/iBox/Sources/BoxList/EditFolder/EditFolderCell.swift +++ b/iBox/Sources/BoxList/EditFolder/EditFolderCell.swift @@ -67,7 +67,7 @@ class EditFolderCell: UITableViewCell { editButton.snp.makeConstraints { make in make.top.bottom.equalToSuperview() - make.trailing.equalToSuperview().inset(10) + make.trailing.equalToSuperview().offset(-10) make.width.equalTo(30) }