Skip to content
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

[Feat/#128] 프로필 화면 재구성 #131

Merged
merged 16 commits into from
Jul 11, 2023
Merged

Conversation

mooyoung2309
Copy link
Member

@mooyoung2309 mooyoung2309 commented Jul 10, 2023

PR 요약

RPReplay_Final1689011362.MP4

Font 디자인시스템 재적용

import SwiftUI

public struct TenadaFont: ViewModifier {
    let size: Font.PumpingFontSize

    public init(size: Font.PumpingFontSize) {
        self.size = size
    }

    public func body(content: Content) -> some View {
        content
            .font(.tenada(size: size))
            .baselineOffset(-size.width(family: .tenada)/7)
    }
}

오직 버그 폰트를 위한 모디파이어 생성

public extension Font {
    /// Pumping 서비스의 Pretendard 폰트를 반환하는 함수 입니다.
    ///
    /// - Parameters:
    ///     - size: Pumping 폰트 사이즈
    ///
    /// - Returns: Pumping의 Pretendard Font
    static func pretendard(size: Font.PumpingFontSize) -> Font {
        return pumpingFont(family: .pretendard, size: size)
    }

    /// Pumping 서비스의 Tenada 폰트를 반환하는 함수 입니다.
    ///
    /// - Parameters:
    ///     - size: Pumping 폰트 사이즈
    ///
    /// - Returns: Pumping의 Tenada Font
    static func tenada(size: Font.PumpingFontSize) -> Font {
        return pumpingFont(family: .tenada, size: size)
    }

    /// Pumping 서비스의 Custom Font를 반환하는 함수 입니다.
    ///
    /// - Parameters:
    ///     - family: Pumping 폰트 패밀리
    ///     - size: Pumping 폰트 사이즈
    ///
    /// - Returns: Pumping의 Custom Font
    static private func pumpingFont(
        family: Font.PumpingFontFamily = .pretendard,
        size: Font.PumpingFontSize) -> Font {
            let weight = pumpingFontWeight(family: family, size: size)
            let fileName = pumpingFontFileName(family: family, weight: weight)
            let width = size.width(family: family)

            return .custom(fileName, size: width)
    }

    /// Pumping 서비스의 Custom Font의 File Name를 반환하는 함수 입니다.
    ///
    /// - Parameters:
    ///     - family: Pumping 폰트 패밀리
    ///     - weight: Pumping 폰트 무게
    ///
    /// - Returns: Pumping의 Custom Font의 FIle Name
    static private func pumpingFontFileName(family: Font.PumpingFontFamily, weight: Font.PumpingFontWeight) -> String {
        switch family {
        case .pretendard:
            switch weight {
            case .black: return "Pretendard-Black"
            case .bold: return "Pretendard-Bold"
            case .extraBold: return "Pretendard-ExtraBold"
            case .extraLight: return "Pretendard-ExtraLight"
            case .light: return "Pretendard-Light"
            case .medium: return "Pretendard-Medium"
            case .semiBold: return "Pretendard-SemiBold"
            case .thin: return "Pretendard-Thin"
            }
        case .tenada:
            return "Tenada"
        }
    }

    /// Pumping 서비스의 Custom Font의 Weight를 반환하는 함수 입니다.
    ///
    /// - Parameters:
    ///     - family: Pumping 폰트 패밀리
    ///     - size: Pumping 폰트 사이즈
    ///
    /// - Returns: Pumping의 Custom Font의 Weight
    static private func pumpingFontWeight(family: Font.PumpingFontFamily, size: Font.PumpingFontSize) -> PumpingFontWeight {
        switch family {
        case .pretendard:
            switch size {
            case .h0, .h1, .h2, .h3, .h4, .h5, .caption1, .caption2:
                return .semiBold

            case .body1, .body2, .body3, .body4:
                return .medium
            }

        case .tenada: return .extraBold
        }
    }
}

public extension Font {
    /// Pumping 서비스의 Font Weight 목록입니다.
    ///
    ///   - pretendard
    ///   - tenada
    enum PumpingFontFamily {
        case pretendard
        case tenada
    }

    /// Pumping 서비스의 Font Weight 목록입니다.
    ///
    ///   - black
    ///   - bold
    ///   - extraBold
    ///   - extraLight
    ///   - light
    ///   - medium
    ///   - semiBold
    ///   - thin
    enum PumpingFontWeight {
        case black
        case bold
        case extraBold
        case extraLight
        case light
        case medium
        case semiBold
        case thin
    }

    /// Pumping 서비스의 Font Size의 목록입니다.
    ///
    ///   - h0
    ///   - h1
    ///   - h2
    ///   - h3
    ///   - h4
    ///   - h5
    ///   - body1
    ///   - body2
    ///   - body3
    ///   - body4
    ///   - caption1
    ///   - caption2
    enum PumpingFontSize {
        case h0
        case h1
        case h2
        case h3
        case h4
        case h5
        case body1
        case body2
        case body3
        case body4
        case caption1
        case caption2

        func width(family: PumpingFontFamily) -> CGFloat {
            switch family {
            case .pretendard:
                switch self {
                case .h0: return 56
                case .h1: return 32
                case .h2: return 24
                case .h3: return 21
                case .h4: return 18
                case .h5: return 16
                case .body1: return 15
                case .body2: return 14
                case .body3: return 13
                case .body4: return 12
                case .caption1: return 11
                case .caption2: return 10
                }
            case .tenada:
                switch self {
                case .h0: return 56
                case .h1: return 36
                case .h2: return 32
                case .h3: return 28
                case .h4: return 18
                case .h5: return 16
                case .body1: return 15
                case .body2: return 14
                case .body3: return 13
                case .body4: return 12
                case .caption1: return 11
                case .caption2: return 10
                }
            }
        }
    }
}

문서화 주석이라는 것을 달아보았습니다. 감사합니다.

API 서버가 꺼져있는 관계로 (사실 작업한번 끊고 갈만 한듯) PR 날립니다.

📌 변경 사항

✅ PR check list

Linked Issue

close #128

@github-actions
Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Comment on lines +19 to +33
public var body: some View {
WithViewStore(self.store) { viewStore in
ScrollView {
VStack(spacing: .zero) {
headerView()

workoutBottomView(viewStore: viewStore)
.frame(maxHeight: .infinity)
.background(PumpingColors.colorGrey100.swiftUIColor)
}
.frame(maxHeight: .infinity)
}
.background(PumpingColors.colorGrey000.swiftUIColor)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workoutBottomView가 아래로 무한 했으면 좋겠어요. 뒷 배경이 회색이 되어야 하는데, 네모로 잘립니다. 이부분 어떻게 작성하면 좋을까요 ? 뷰 좀 어렵습니다.. @derrickkim0109 @parkhj0423

@mooyoung2309 mooyoung2309 self-assigned this Jul 10, 2023
@mooyoung2309 mooyoung2309 merged commit 87491ea into develop Jul 11, 2023
1 check passed
@mooyoung2309 mooyoung2309 deleted the feat/#128-profile-api branch July 11, 2023 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] 프로필 화면 재구성
1 participant