Skip to content

Commit

Permalink
Merge pull request #58 from SOPT-all/style/#56-FloatingButton
Browse files Browse the repository at this point in the history
Style/#56 floating button
  • Loading branch information
HEHEEUN authored Nov 28, 2024
2 parents 14901d8 + cbdfe5c commit 9960bca
Show file tree
Hide file tree
Showing 8 changed files with 272 additions and 48 deletions.
5 changes: 1 addition & 4 deletions saftyReport/saftyReport/Source/Main/Cell/BannerCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

import UIKit

class BannerCell: UICollectionViewCell {
let cellIdentifier: String = "BannerCell"

let bannerImageView = UIImageView().then {
class BannerCell: UICollectionViewCell {let bannerImageView = UIImageView().then {
$0.contentMode = .scaleAspectFill
}

Expand Down
53 changes: 53 additions & 0 deletions saftyReport/saftyReport/Source/Main/Cell/ButtonTableCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// ButtonTableCell.swift
// saftyReport
//
// Created by 김희은 on 11/28/24.
//

import UIKit

import SnapKit
import Then

class ButtonTableCell: UITableViewCell {
lazy var iconImageView = UIImageView().then {
$0.contentMode = .scaleAspectFit
}

var titleLabel = UILabel().then {
$0.textColor = .gray13
}

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)

setUI()
setLayout()
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

private func setUI() {
self.addSubviews(iconImageView, titleLabel)
}

private func setLayout() {
iconImageView.snp.makeConstraints {
$0.leading.equalToSuperview().inset(14)
$0.centerY.equalToSuperview()
}

titleLabel.snp.makeConstraints {
$0.leading.equalTo(iconImageView.snp.trailing).offset(10)
$0.centerY.equalToSuperview()
}
}

func configure(with tableItem: TableItem) {
iconImageView.image = tableItem.image
titleLabel.attributedText = .styled(text: tableItem.title, style: .body9, alignment: .left)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,21 @@
import UIKit

class FinishedReportEXCell: UICollectionViewCell {
let cellIdentifier = "FinishedReportEXCell"

let stackViewList = [1, 2]
private let stackView = UIStackView().then {
$0.axis = .vertical
$0.spacing = 9
}

private let beforeImageView = UIImageView().then {
$0.image = UIImage(named: "image_before")
$0.image = UIImage.imageBefore
$0.contentMode = .scaleAspectFill
$0.layer.cornerRadius = 15
$0.clipsToBounds = true
}

private let afterImageview = UIImageView().then {
$0.image = UIImage(named: "image_after")
$0.image = UIImage.imageAfter
$0.contentMode = .scaleAspectFill
$0.layer.cornerRadius = 15
$0.clipsToBounds = true
Expand All @@ -39,7 +37,7 @@ class FinishedReportEXCell: UICollectionViewCell {
$0.pageIndicatorTintColor = .gray3
$0.backgroundColor = .clear
$0.layer.cornerRadius = 5
let dotImage = UIImage(named: "Ellipse5x5")?.withConfiguration(
let dotImage = UIImage.ellipse5X5.withConfiguration(
UIImage.SymbolConfiguration(pointSize: 5)
)
$0.preferredIndicatorImage = dotImage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
import UIKit

class MyReportBannerCell: UICollectionViewCell {
let cellIdentifier: String = "MyReportBannerCell"

let bannerImgList = ["img_promotion_1", "img_promotion_2", "img_promotion_3"]

lazy var leftButton = UIButton().then {
$0.setBackgroundImage(UIImage(named: "icn_arrow_left_round_white_24px"), for: .normal)
$0.setBackgroundImage(UIImage.icnArrowLeftRoundWhite24Px, for: .normal)
$0.addTarget(self, action: #selector(leftButtonTapped), for: .touchUpInside)
}

lazy var rightButton = UIButton().then {
$0.setBackgroundImage(UIImage(named: "icn_arrow_right_round_white_24px"), for: .normal)
$0.setBackgroundImage(UIImage.icnArrowRightRoundWhite24Px, for: .normal)
$0.addTarget(self, action: #selector(rightButtonTapped), for: .touchUpInside)
}

Expand Down Expand Up @@ -47,7 +46,7 @@ class MyReportBannerCell: UICollectionViewCell {
$0.backgroundColor = .gray13Opacity40
$0.layer.cornerRadius = 5

let dotImage = UIImage(named: "Ellipse5x5")?.withConfiguration(
let dotImage = UIImage.ellipse5X5.withConfiguration(
UIImage.SymbolConfiguration(pointSize: 5)
)
$0.preferredIndicatorImage = dotImage
Expand All @@ -60,11 +59,7 @@ class MyReportBannerCell: UICollectionViewCell {

setUI()
setLayout()

collectionView.dataSource = self
collectionView.delegate = self

collectionView.register(BannerCell.self, forCellWithReuseIdentifier: BannerCell.cellIdentifier)
setCollectionView()
}

required init?(coder: NSCoder) {
Expand All @@ -77,11 +72,7 @@ class MyReportBannerCell: UICollectionViewCell {
self.addSubviews(leftButton, rightButton)
}

private func setLayout() {
leftButton.translatesAutoresizingMaskIntoConstraints = false
rightButton.translatesAutoresizingMaskIntoConstraints = false
pageControl.translatesAutoresizingMaskIntoConstraints = false

private func setLayout() {
collectionView.snp.makeConstraints {
$0.edges.equalToSuperview()
}
Expand All @@ -101,6 +92,13 @@ class MyReportBannerCell: UICollectionViewCell {
}
}

private func setCollectionView(){
collectionView.dataSource = self
collectionView.delegate = self

collectionView.register(BannerCell.self, forCellWithReuseIdentifier: BannerCell.cellIdentifier)
}

private func scrollToCurrentPage() {
let indexPath = IndexPath(item: pageControl.currentPage, section: 0)
collectionView.scrollToItem(at: indexPath, at: .centeredHorizontally, animated: true)
Expand Down Expand Up @@ -146,7 +144,10 @@ extension MyReportBannerCell: UICollectionViewDataSource {
}

extension MyReportBannerCell: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath
) -> CGSize {
return CGSize(width: collectionView.frame.width, height: collectionView.frame.height)
}
}
8 changes: 3 additions & 5 deletions saftyReport/saftyReport/Source/Main/Cell/MyReportCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import UIKit

class MyReportCell: UICollectionViewCell {
let cellIdentifier: String = "MyReportCell"

private let myReportView = UIView().then {
$0.layer.cornerRadius = 15
$0.backgroundColor = .gray1
Expand Down Expand Up @@ -54,18 +52,18 @@ class MyReportCell: UICollectionViewCell {
}

private var myReportCountImageView = UIImageView().then {
$0.image = UIImage(named: "graph_year_report")
$0.image = UIImage.graphYearReport
$0.contentMode = .scaleAspectFit
$0.tintColor = .primaryOrange
}

private var myReportSubImageView = UIImageView().then {
$0.image = UIImage(named: "sub_graph_month_report")
$0.image = UIImage.subGraphMonthReport
$0.contentMode = .scaleAspectFit
}

private var myMonthlyReportImageView = UIImageView().then {
$0.image = UIImage(named: "graph_month_report")
$0.image = UIImage.graphMonthReport
$0.contentMode = .scaleAspectFit
$0.tintColor = .primaryOrange
}
Expand Down
2 changes: 1 addition & 1 deletion saftyReport/saftyReport/Source/Main/MainContentsItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import UIKit

enum MainContentsItemLayout {
struct MainContentsItemLayout {
static func createLayout() -> UICollectionViewCompositionalLayout {
return UICollectionViewCompositionalLayout { (sectionNumber, _ environment) -> NSCollectionLayoutSection? in
let section: NSCollectionLayoutSection
Expand Down
Loading

0 comments on commit 9960bca

Please sign in to comment.