feat(theme): 디자인 토큰을 추가한다
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// KoreanFontModifier.swift
|
||||
// FontModifier.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 1/23/26.
|
||||
@@ -7,6 +7,52 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum SodaTypography {
|
||||
case heading1
|
||||
case heading2
|
||||
case heading3
|
||||
case heading4
|
||||
case body1
|
||||
case body2
|
||||
case body3
|
||||
case body4
|
||||
case body5
|
||||
case body6
|
||||
case caption1
|
||||
case caption2
|
||||
case caption3
|
||||
|
||||
var size: CGFloat {
|
||||
switch self {
|
||||
case .heading1:
|
||||
return 24
|
||||
case .heading2:
|
||||
return 22
|
||||
case .heading3:
|
||||
return 20
|
||||
case .heading4:
|
||||
return 18
|
||||
case .body1, .body2, .body3:
|
||||
return 16
|
||||
case .body4, .body5, .body6:
|
||||
return 14
|
||||
case .caption1, .caption2, .caption3:
|
||||
return 12
|
||||
}
|
||||
}
|
||||
|
||||
var weight: SwiftUI.Font.Weight {
|
||||
switch self {
|
||||
case .heading1, .heading2, .heading3, .heading4, .body1, .body4, .caption1:
|
||||
return .bold
|
||||
case .body2, .body5, .caption2:
|
||||
return .medium
|
||||
case .body3, .body6, .caption3:
|
||||
return .regular
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func resolvedLanguageCode(currentLocale: Locale) -> String? {
|
||||
if let raw = UserDefaults.standard.string(forKey: "app.language"),
|
||||
let option = LanguageOption(rawValue: raw),
|
||||
@@ -42,7 +88,7 @@ private func japaneseFontName(for weight: SwiftUI.Font.Weight) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
struct KoreanFontModifier: ViewModifier {
|
||||
struct FontModifier: ViewModifier {
|
||||
@Environment(\.locale) private var locale
|
||||
let size: CGFloat
|
||||
let weight: SwiftUI.Font.Weight
|
||||
@@ -63,7 +109,11 @@ struct KoreanFontModifier: ViewModifier {
|
||||
|
||||
extension View {
|
||||
func appFont(size: CGFloat, weight: SwiftUI.Font.Weight = .regular) -> some View {
|
||||
self.modifier(KoreanFontModifier(size: size, weight: weight))
|
||||
self.modifier(FontModifier(size: size, weight: weight))
|
||||
}
|
||||
|
||||
func appFont(_ typography: SodaTypography) -> some View {
|
||||
appFont(size: typography.size, weight: typography.weight)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,4 +129,8 @@ extension Text {
|
||||
|
||||
return self.font(.system(size: size, weight: weight))
|
||||
}
|
||||
|
||||
func appFont(_ typography: SodaTypography) -> Text {
|
||||
appFont(size: typography.size, weight: typography.weight)
|
||||
}
|
||||
}
|
||||
@@ -35,4 +35,38 @@ extension Color {
|
||||
static let mainRed2 = Color(hex: "ea3a25")
|
||||
static let mainRed3 = Color(hex: "dd4500")
|
||||
static let mainYellow = Color(hex: "ffdc00")
|
||||
|
||||
static let soda50 = Color(hex: "E6F9FF")
|
||||
static let soda100 = Color(hex: "B8EEFD")
|
||||
static let soda200 = Color(hex: "85E1FB")
|
||||
static let soda300 = Color(hex: "4FD2F9")
|
||||
static let soda400 = Color(hex: "00BDF7")
|
||||
static let soda500 = Color(hex: "00A0DF")
|
||||
static let soda600 = Color(hex: "0081C2")
|
||||
static let soda700 = Color(hex: "006BA4")
|
||||
static let soda800 = Color(hex: "004F7F")
|
||||
static let soda900 = Color(hex: "052742")
|
||||
|
||||
static let red50 = Color(hex: "FFF1F2")
|
||||
static let red100 = Color(hex: "FFD7D9")
|
||||
static let red200 = Color(hex: "FFB3B7")
|
||||
static let red300 = Color(hex: "FF858B")
|
||||
static let red400 = Color(hex: "FF4C3C")
|
||||
|
||||
static let green50 = Color(hex: "F5FBEF")
|
||||
static let green100 = Color(hex: "E9FADB")
|
||||
static let green200 = Color(hex: "C0F595")
|
||||
static let green300 = Color(hex: "9FFB56")
|
||||
static let green400 = Color(hex: "73FF01")
|
||||
|
||||
static let gray50 = Color(hex: "FAFAFA")
|
||||
static let gray100 = Color(hex: "F2F2F2")
|
||||
static let gray200 = Color(hex: "E2E2E2")
|
||||
static let gray300 = Color(hex: "CCCCCC")
|
||||
static let gray400 = Color(hex: "B5B5B5")
|
||||
static let gray500 = Color(hex: "959595")
|
||||
static let gray600 = Color(hex: "787878")
|
||||
static let gray700 = Color(hex: "494949")
|
||||
static let gray800 = Color(hex: "343434")
|
||||
static let gray900 = Color(hex: "202020")
|
||||
}
|
||||
|
||||
12
SodaLive/Sources/UI/Theme/Radius.swift
Normal file
12
SodaLive/Sources/UI/Theme/Radius.swift
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// Radius.swift
|
||||
// SodaLive
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum SodaRadius {
|
||||
static let r4: CGFloat = 4
|
||||
static let r8: CGFloat = 8
|
||||
static let r14: CGFloat = 14
|
||||
}
|
||||
20
SodaLive/Sources/UI/Theme/Spacing.swift
Normal file
20
SodaLive/Sources/UI/Theme/Spacing.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Spacing.swift
|
||||
// SodaLive
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum SodaSpacing {
|
||||
static let s4: CGFloat = 4
|
||||
static let s6: CGFloat = 6
|
||||
static let s8: CGFloat = 8
|
||||
static let s12: CGFloat = 12
|
||||
static let s14: CGFloat = 14
|
||||
static let s16: CGFloat = 16
|
||||
static let s20: CGFloat = 20
|
||||
static let s24: CGFloat = 24
|
||||
static let s28: CGFloat = 28
|
||||
static let s32: CGFloat = 32
|
||||
static let s48: CGFloat = 48
|
||||
}
|
||||
Reference in New Issue
Block a user