diff --git a/project/Projects/Presentation/DSKit/Sources/CommonUI/Button/StateButtonTyp1.swift b/project/Projects/Presentation/DSKit/Sources/CommonUI/Button/StateButtonTyp1.swift index 41a686e9..e1c794a8 100644 --- a/project/Projects/Presentation/DSKit/Sources/CommonUI/Button/StateButtonTyp1.swift +++ b/project/Projects/Presentation/DSKit/Sources/CommonUI/Button/StateButtonTyp1.swift @@ -13,21 +13,26 @@ public class StateButtonTyp1: UIView { // Init values public private(set) var state: State - public var normalAppearance = StateSetting.normalDefault - public var accentAppearance = StateSetting.accentDefault + public var normalAppearance: StateSetting + public var accentAppearance: StateSetting public let eventPublisher: PublishRelay = .init() // View public let label: IdleLabel = { - let view = IdleLabel(typography: .Body3) - return view }() - public init(text: String, initial: State) { + public init( + text: String, + initial: State, + normalAppearance: StateSetting = .normalDefault, + accentAppearance: StateSetting = .accentDefault + ) { self.state = initial + self.normalAppearance = normalAppearance + self.accentAppearance = accentAppearance super.init(frame: .zero) @@ -46,7 +51,7 @@ public class StateButtonTyp1: UIView { self.layer.cornerRadius = 6.0 self.clipsToBounds = true - applySetting(setting: self.state == .accent ? .accentDefault : .normalDefault) + applySetting(setting: self.state == .accent ? accentAppearance : normalAppearance) } private func setAutoLayout() { @@ -114,13 +119,13 @@ public extension StateButtonTyp1 { struct StateSetting { - let textColor: UIColor - let typography: Typography + public var textColor: UIColor + public var typography: Typography - let borderColor: UIColor - let backgroundColor: UIColor + public var borderColor: UIColor + public var backgroundColor: UIColor - static var normalDefault: StateSetting { + public static var normalDefault: StateSetting { StateSetting( textColor: DSKitAsset.Colors.gray500.color, typography: .Body3, @@ -129,7 +134,7 @@ public extension StateButtonTyp1 { ) } - static var accentDefault: StateSetting { + public static var accentDefault: StateSetting { StateSetting( textColor: DSKitAsset.Colors.orange500.color, typography: .Subtitle4, diff --git a/project/Projects/Presentation/DSKit/Sources/Component/Label/IdleLabel.swift b/project/Projects/Presentation/DSKit/Sources/Component/Label/IdleLabel.swift index 5a20a57f..3c6867d2 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/Label/IdleLabel.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/Label/IdleLabel.swift @@ -93,6 +93,6 @@ public class IdleLabel: UILabel { let attributedStr = NSMutableAttributedString(string: currentText, attributes: currentAttributes) self.attributedText = attributedStr - self.sizeToFit() + self.invalidateIntrinsicContentSize() } } diff --git a/project/Projects/Presentation/DSKit/Sources/Component/TextField/MultiLineTextField.swift b/project/Projects/Presentation/DSKit/Sources/Component/TextField/MultiLineTextField.swift index 838b1eb5..c226d1ec 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/TextField/MultiLineTextField.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/TextField/MultiLineTextField.swift @@ -96,6 +96,7 @@ public class MultiLineTextField: UITextView { placeHolderLabel.topAnchor.constraint(equalTo: frameGuide.topAnchor, constant: textContainerInset.top), placeHolderLabel.leftAnchor.constraint(equalTo: frameGuide.leftAnchor, constant: textContainerInset.left), placeHolderLabel.rightAnchor.constraint(equalTo: frameGuide.rightAnchor, constant: -textContainerInset.right), + placeHolderLabel.bottomAnchor.constraint(equalTo: frameGuide.bottomAnchor, constant: -textContainerInset.bottom), ]) } diff --git a/project/Projects/Presentation/DSKit/Sources/Component/Typography/Typograpy.swift b/project/Projects/Presentation/DSKit/Sources/Component/Typography/Typograpy.swift index 335889e5..c6d6cb8e 100644 --- a/project/Projects/Presentation/DSKit/Sources/Component/Typography/Typograpy.swift +++ b/project/Projects/Presentation/DSKit/Sources/Component/Typography/Typograpy.swift @@ -21,6 +21,7 @@ public enum Typography { case Heading2 case Heading3 case Heading4 + case Heading5 case Subtitle1 case Subtitle2 @@ -37,23 +38,25 @@ public enum Typography { var lineHeight: CGFloat? { switch self { case .Heading1: - 36 + 38 case .Heading2: - 32 + 36 case .Heading3: - 30 + 32 case .Heading4: + 30 + case .Heading5: 26 case .Subtitle1: - 32 + 36 case .Subtitle2: - 30 + 32 case .Subtitle3: - 26 + 30 case .Subtitle4: - 22 + 26 case .Body1: @@ -63,6 +66,9 @@ public enum Typography { case .Body3: 22 + case .caption: + 22 + default: nil } @@ -89,77 +95,93 @@ public enum Typography { case .Heading2: createAttribute( weight: .Bold, - size: 20, + size: 22, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) case .Heading3: createAttribute( weight: .Bold, - size: 18, + size: 20, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) case .Heading4: + createAttribute( + weight: .Bold, + size: 18, + letterSpacing: -0.2, + color: DSKitAsset.Colors.gray900.color + ) + case .Heading5: createAttribute( weight: .Bold, size: 16, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) + + case .Subtitle1: createAttribute( weight: .Semibold, - size: 20, + size: 22, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) case .Subtitle2: createAttribute( weight: .Semibold, - size: 18, + size: 20, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) case .Subtitle3: createAttribute( weight: .Semibold, - size: 16, + size: 18, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) case .Subtitle4: createAttribute( weight: .Semibold, - size: 14, + size: 16, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) + + + case .Body1: createAttribute( weight: .medium, - size: 18, + size: 20, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) case .Body2: createAttribute( weight: .medium, - size: 16, + size: 18, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) case .Body3: createAttribute( weight: .medium, - size: 14, + size: 16, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) + + + + case .caption: createAttribute( weight: .medium, - size: 12, + size: 14, letterSpacing: -0.2, color: DSKitAsset.Colors.gray900.color ) @@ -198,7 +220,9 @@ public enum Typography { paragraphStyle.minimumLineHeight = lineHeight paragraphStyle.maximumLineHeight = lineHeight - baseLineOffset = (lineHeight-font.lineHeight)/2 + let wordMinHeight = font.ascender + abs(font.descender) + + baseLineOffset = (lineHeight-wordMinHeight)/2 } return [ diff --git a/project/Projects/Presentation/Feature/Base/Sources/PostDetailForCenter/EditPost/WorkTimeAndPayContentView.swift b/project/Projects/Presentation/Feature/Base/Sources/PostDetailForCenter/EditPost/WorkTimeAndPayContentView.swift index 5e9bbd1d..87fbb0d0 100644 --- a/project/Projects/Presentation/Feature/Base/Sources/PostDetailForCenter/EditPost/WorkTimeAndPayContentView.swift +++ b/project/Projects/Presentation/Feature/Base/Sources/PostDetailForCenter/EditPost/WorkTimeAndPayContentView.swift @@ -32,10 +32,16 @@ public class WorkTimeAndPayContentView: UIView { // 근무 요일 let workDayButtons: [StateButtonTyp1] = { WorkDay.allCases.map { day in - StateButtonTyp1( + var normalSetting = StateButtonTyp1.StateSetting.normalDefault + normalSetting.typography = .Body2 + + let button = StateButtonTyp1( text: day.korOneLetterText, - initial: .normal + initial: .normal, + normalAppearance: normalSetting ) + + return button } }() @@ -107,7 +113,7 @@ public class WorkTimeAndPayContentView: UIView { IdleContentTitleLabel(titleText: "근무 요일"), HStack([ workDayButtons as [UIView], - [UIView()] + [Spacer()] ].flatMap({ $0 }), spacing: 4), ], spacing: 6,