Skip to content

Commit

Permalink
✨ :: typography
Browse files Browse the repository at this point in the history
  • Loading branch information
lsh1202 committed Aug 1, 2024
1 parent 7044bb8 commit 5b061cd
Show file tree
Hide file tree
Showing 5 changed files with 278 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/QDS/Component/Button/QvickButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public struct QvickButton: View {
.foregroundStyle(disable ? Color.labelLightDisable : .primaryNormal)
.overlay {
Text(text)
.font(.pretendard(.bold, size: 17))
.font(.pretendard(.semibold, size: 17))
.foregroundStyle(.white)
}
}
Expand Down
6 changes: 4 additions & 2 deletions Sources/QDS/Component/TextField/QvickTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ public struct QvickTextField: View {
if isSecure {
SecureField(
text: $text,
prompt: Text(prompt).font(.pretendard(.regular, size: 14))
prompt:
Text(prompt)
.font(.label1Normal(.regular))
) {

}
Expand Down Expand Up @@ -61,7 +63,7 @@ public struct QvickTextField: View {
} else {
TextField(
text: $text,
prompt: Text(prompt).font(.pretendard(.regular, size: 14))
prompt: Text(prompt).font(.label1Normal(.regular))
) {

}
Expand Down
62 changes: 62 additions & 0 deletions Sources/QDS/Foundation/Typography/Font+Ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,66 @@ extension Font {
public static func pretendard( _ weight: QvickFont.Pretendard = .regular, size: CGFloat ) -> Font {
return weight.font(size: size)
}

public static func display1( _ style: QvickTextStyle.Display1 ) -> Font {
return style.font
}
public static func display2( _ style: QvickTextStyle.Display2 ) -> Font {
return style.font
}

public static func title1( _ style: QvickTextStyle.Title1 ) -> Font {
return style.font
}
public static func title2( _ style: QvickTextStyle.Title2 ) -> Font {
return style.font
}
public static func title3( _ style: QvickTextStyle.Title3 ) -> Font {
return style.font
}

public static func heading1( _ style: QvickTextStyle.Heading1 ) -> Font {
return style.font
}
public static func heading2( _ style: QvickTextStyle.Heading2 ) -> Font {
return style.font
}

public static func headline1( _ style: QvickTextStyle.HeadLine1 ) -> Font {
return style.font
}
public static func headline2( _ style: QvickTextStyle.HeadLine2 ) -> Font {
return style.font
}

public static func body1Normal( _ style: QvickTextStyle.Body1Normal ) -> Font {
return style.font
}
public static func body1Reading( _ style: QvickTextStyle.Body1Reading ) -> Font {
return style.font
}

public static func body2Normal( _ style: QvickTextStyle.Body2Normal ) -> Font {
return style.font
}
public static func body2Reading( _ style: QvickTextStyle.Body2Reading ) -> Font {
return style.font
}

public static func label1Normal( _ style: QvickTextStyle.Label1Normal ) -> Font {
return style.font
}
public static func label1Reading( _ style: QvickTextStyle.Label1Reading ) -> Font {
return style.font
}
public static func label2( _ style: QvickTextStyle.Label2 ) -> Font {
return style.font
}

public static func caption1( _ style: QvickTextStyle.Caption1 ) -> Font {
return style.font
}
public static func caption2( _ style: QvickTextStyle.Caption2 ) -> Font {
return style.font
}
}
181 changes: 181 additions & 0 deletions Sources/QDS/Foundation/Typography/QvickTextStyle+Ext.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
import SwiftUI

extension QvickTextStyle.Display1: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 56)
case .medium: .pretendard(.medium, size: 56)
case .regular: .pretendard(.regular, size: 56)
}
}
}

extension QvickTextStyle.Display2: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 40)
case .medium: .pretendard(.medium, size: 40)
case .regular: .pretendard(.regular, size: 40)
}
}
}

extension QvickTextStyle.Title1: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 36)
case .medium: .pretendard(.medium, size: 36)
case .regular: .pretendard(.regular, size: 36)
}
}
}

extension QvickTextStyle.Title2: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 28)
case .medium: .pretendard(.medium, size: 28)
case .regular: .pretendard(.regular, size: 28)
}
}
}

extension QvickTextStyle.Title3: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 24)
case .medium: .pretendard(.medium, size: 24)
case .regular: .pretendard(.regular, size: 24)
}
}
}

extension QvickTextStyle.Heading1: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 22)
case .medium: .pretendard(.medium, size: 22)
case .regular: .pretendard(.regular, size: 22)
}
}
}

extension QvickTextStyle.Heading2: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 20)
case .medium: .pretendard(.medium, size: 20)
case .regular: .pretendard(.regular, size: 20)
}
}
}

extension QvickTextStyle.HeadLine1: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 18)
case .medium: .pretendard(.medium, size: 18)
case .regular: .pretendard(.regular, size: 18)
}
}
}

extension QvickTextStyle.HeadLine2: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 17)
case .medium: .pretendard(.medium, size: 17)
case .regular: .pretendard(.regular, size: 17)
}
}
}

extension QvickTextStyle.Body1Normal: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 16)
case .medium: .pretendard(.medium, size: 16)
case .regular: .pretendard(.regular, size: 16)
}
}
}

extension QvickTextStyle.Body1Reading: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 16)
case .medium: .pretendard(.medium, size: 16)
case .regular: .pretendard(.regular, size: 16)
}
}
}

extension QvickTextStyle.Body2Normal: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 15)
case .medium: .pretendard(.medium, size: 15)
case .regular: .pretendard(.regular, size: 15)
}
}
}

extension QvickTextStyle.Body2Reading: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 15)
case .medium: .pretendard(.medium, size: 15)
case .regular: .pretendard(.regular, size: 15)
}
}
}

extension QvickTextStyle.Label1Normal: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 14)
case .medium: .pretendard(.medium, size: 14)
case .regular: .pretendard(.regular, size: 14)
}
}
}

extension QvickTextStyle.Label1Reading: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 14)
case .medium: .pretendard(.medium, size: 14)
case .regular: .pretendard(.regular, size: 14)
}
}
}

extension QvickTextStyle.Label2: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 13)
case .medium: .pretendard(.medium, size: 13)
case .regular: .pretendard(.regular, size: 13)
}
}
}

extension QvickTextStyle.Caption1: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 12)
case .medium: .pretendard(.medium, size: 12)
case .regular: .pretendard(.regular, size: 12)
}
}
}

extension QvickTextStyle.Caption2: QvickFont.Fontable {
public var font: Font {
switch self {
case .bold: .pretendard(.bold, size: 11)
case .medium: .pretendard(.medium, size: 11)
case .regular: .pretendard(.regular, size: 11)
}
}
}
30 changes: 30 additions & 0 deletions Sources/QDS/Foundation/Typography/QvickTextStyle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import SwiftUI

public struct QvickTextStyle {
public enum Display1 { case bold, medium, regular }
public enum Display2 { case bold, medium, regular }

public enum Title1 { case bold, medium, regular }
public enum Title2 { case bold, medium, regular }
public enum Title3 { case bold, medium, regular }

public enum Heading1 { case bold, medium, regular }
public enum Heading2 { case bold, medium, regular }

public enum HeadLine1 { case bold, medium, regular }
public enum HeadLine2 { case bold, medium, regular }

public enum Body1Normal { case bold, medium, regular }
public enum Body1Reading { case bold, medium, regular }

public enum Body2Normal { case bold, medium, regular }
public enum Body2Reading { case bold, medium, regular }

public enum Label1Normal { case bold, medium, regular }
public enum Label1Reading { case bold, medium, regular }
public enum Label2 { case bold, medium, regular }

public enum Caption1 { case bold, medium, regular }
public enum Caption2 { case bold, medium, regular }

}

0 comments on commit 5b061cd

Please sign in to comment.