From 4a7da0ccfedccfc2d1d222dabb72dc51bcb94e62 Mon Sep 17 00:00:00 2001 From: hhhello Date: Sat, 20 Jul 2024 17:21:51 +0900 Subject: [PATCH] feat: Apply new Design system --- Source/DDS/Component/Button/Button.swift | 265 +++++++++++------- Source/DDS/Component/CheckBox/Checkbox.swift | 41 +-- Source/DDS/Component/Divider/Divider.swift | 47 ++++ .../DDS/Component/EmptyView/EmptyView.swift | 2 +- .../NavigationView/NavigationView.swift | 12 +- .../NavigationViewProtocol.swift | 32 +-- .../CircularProgressView.swift | 0 .../LinearProgressView.swift | 0 .../DDS/Component/ScrollView/ScrollView.swift | 14 +- .../TopAppBar.swift} | 22 +- .../TopAppBarButton.swift} | 2 +- .../DDS/Component/TopTabView/TopTabView.swift | 35 ++- Source/DDS/Foundation/Dodam/Dodam.swift | 2 + .../Checkmark.imageset/checkmark.svg | 2 +- .../DDS/Foundation/Typography/Type/Body.swift | 4 +- .../Foundation/Typography/Type/Caption1.swift | 4 +- .../Foundation/Typography/Type/Caption2.swift | 4 +- .../Foundation/Typography/Type/Heading1.swift | 4 +- .../Foundation/Typography/Type/Heading2.swift | 4 +- .../Foundation/Typography/Type/Headline.swift | 4 +- .../Foundation/Typography/Type/Label.swift | 4 +- .../Foundation/Typography/Type/Title1.swift | 4 +- .../Foundation/Typography/Type/Title2.swift | 4 +- .../Foundation/Typography/Type/Title3.swift | 4 +- 24 files changed, 321 insertions(+), 195 deletions(-) create mode 100644 Source/DDS/Component/Divider/Divider.swift rename Source/DDS/Component/{CircularProgressView => ProgressIndicator}/CircularProgressView.swift (100%) rename Source/DDS/Component/{LinearProgressView => ProgressIndicator}/LinearProgressView.swift (100%) rename Source/DDS/Component/{NavigationBar/NavigationBar.swift => TopAppBar/TopAppBar.swift} (91%) rename Source/DDS/Component/{NavigationBar/NavigationButton.swift => TopAppBar/TopAppBarButton.swift} (65%) diff --git a/Source/DDS/Component/Button/Button.swift b/Source/DDS/Component/Button/Button.swift index 696ae89..2bffc26 100644 --- a/Source/DDS/Component/Button/Button.swift +++ b/Source/DDS/Component/Button/Button.swift @@ -1,40 +1,97 @@ import SwiftUI +extension DodamButton.ButtonType { + var shape: DodamShape { + switch self { + case .cta: .small + case .large: .small + case .medium: .small + case .small: .extraSmall + } + } + + var height: CGFloat { + switch self { + case .cta: 48 + case .large: 44 + case .medium: 40 + case .small: 36 + } + } + + var horizontalPadding: CGFloat { + switch self { + case .cta: 12 + case .large: 12 + case .medium: 8 + case .small: 8 + } + } + + var iconSize: CGFloat { + switch self { + case .cta: 20 + case .large: 20 + case .medium: 18 + case .small: 14 + } + } + + var titleHorizontalPadding: CGFloat { + switch self { + case .cta: 8 + case .large: 8 + case .medium: 6 + case .small: 4 + } + } + + var font: Font { + switch self { + case .cta: .body(.medium) + case .large: .body(.medium) + case .medium: .body(.medium) + case .small: .label(.medium) + } + } +} + @available(macOS 12, iOS 15, *) public struct DodamButton: View { + public enum ButtonType { + case cta + case large + case medium + case small + } + public typealias AsyncAction = () async -> Void + private let type: ButtonType private let title: String - private let icon: Image? + private let leadingIcon: Image? + private let trailingIcon: Image? private let action: AsyncAction - private let font: Font - private let iconSize: CGFloat - private let height: CGFloat - private let padding: CGFloat? private let isDisabled: Bool private let background: DodamColorable private let foreground: DodamColorable private init( + type: ButtonType, title: String, - icon: Image?, + leadingIcon: Image?, + trailingIcon: Image?, action: @escaping AsyncAction, - font: Font = .body(.medium), - iconSize: CGFloat = 19, - height: CGFloat = 48, - padding: CGFloat? = nil, isDisabled: Bool = false, background: DodamColorable = DodamColor.Primary.normal, foreground: DodamColorable = DodamColor.Static.white ) { + self.type = type self.title = title - self.icon = icon + self.leadingIcon = leadingIcon + self.trailingIcon = trailingIcon self.action = action - self.font = font - self.iconSize = iconSize - self.height = height - self.padding = padding self.isDisabled = isDisabled self.background = background self.foreground = foreground @@ -42,68 +99,71 @@ public struct DodamButton: View { public static func fullWidth( title: String, - icon: Image? = nil, + leadingIcon: Image? = nil, + trailingIcon: Image? = nil, action: @escaping AsyncAction ) -> Self { .init( + type: .cta, title: title, - icon: icon, + leadingIcon: leadingIcon, + trailingIcon: trailingIcon, action: action ) } public static func large( title: String, - icon: Image? = nil, + leadingIcon: Image? = nil, + trailingIcon: Image? = nil, action: @escaping AsyncAction ) -> Self { .init( + type: .large, title: title, - icon: icon, - action: action, - padding: 16 + leadingIcon: leadingIcon, + trailingIcon: trailingIcon, + action: action ) } public static func medium( title: String, - icon: Image? = nil, + leadingIcon: Image? = nil, + trailingIcon: Image? = nil, action: @escaping AsyncAction ) -> Self { .init( + type: .medium, title: title, - icon: icon, - action: action, - height: 36, - padding: 8 + leadingIcon: leadingIcon, + trailingIcon: trailingIcon, + action: action ) } public static func small( title: String, - icon: Image? = nil, + leadingIcon: Image? = nil, + trailingIcon: Image? = nil, action: @escaping AsyncAction ) -> Self { .init( + type: .small, title: title, - icon: icon, - action: action, - font: .suit(size: 14, weight: .regular), - iconSize: 17, - height: 28, - padding: 8 + leadingIcon: leadingIcon, + trailingIcon: trailingIcon, + action: action ) } public func disabled(_ condition: Bool = true) -> Self { .init( + type: self.type, title: self.title, - icon: self.icon, + leadingIcon: self.leadingIcon, + trailingIcon: self.trailingIcon, action: self.action, - font: self.font, - iconSize: self.iconSize, - height: self.height, - padding: self.padding, isDisabled: condition, background: self.background, foreground: self.foreground @@ -112,13 +172,11 @@ public struct DodamButton: View { public func background(_ color: DodamColorable) -> Self { .init( + type: self.type, title: self.title, - icon: self.icon, + leadingIcon: self.leadingIcon, + trailingIcon: self.trailingIcon, action: self.action, - font: self.font, - iconSize: self.iconSize, - height: self.height, - padding: self.padding, isDisabled: self.isDisabled, background: color, foreground: self.foreground @@ -127,13 +185,11 @@ public struct DodamButton: View { public func foreground(_ color: DodamColorable) -> Self { .init( + type: self.type, title: self.title, - icon: self.icon, + leadingIcon: self.leadingIcon, + trailingIcon: self.trailingIcon, action: self.action, - font: self.font, - iconSize: self.iconSize, - height: self.height, - padding: self.padding, isDisabled: self.isDisabled, background: self.background, foreground: color @@ -143,14 +199,10 @@ public struct DodamButton: View { @State private var isPerformingTask: Bool = false private var maxWidth: CGFloat? { - guard padding != nil else { return .infinity } + guard type != .cta else { return .infinity } return nil } - private var cornerRadius: CGFloat { - height >= 48 ? 10 : 8 - } - private var isTranslucent: Bool { isDisabled || isPerformingTask } @@ -165,69 +217,82 @@ public struct DodamButton: View { isPerformingTask = false } } label: { - HStack(spacing: 8) { - if let icon { - icon + HStack(spacing: 0) { + if let leadingIcon { + leadingIcon .resizable() .scaledToFit() - .frame( - width: iconSize, - height: iconSize - ) + .frame(width: type.iconSize,height: type.iconSize) } Text(title) - .font(font) + .font(type.font) + .padding(.horizontal, type.titleHorizontalPadding) + if let trailingIcon { + trailingIcon + .resizable() + .scaledToFit() + .frame(width: type.iconSize,height: type.iconSize) + } } .opacity(isPerformingTask ? 0 : 1) - .frame(height: height) - .padding(.horizontal, padding) + .frame(height: type.height) + .padding(.horizontal, type.horizontalPadding) .frame(maxWidth: maxWidth) .foreground(foreground) } .disabled(isTranslucent) .background(background) - .clipShape( - RoundedRectangle(cornerRadius: cornerRadius) - ) + .clipShape(type.shape) .opacity(isTranslucent ? 0.5 : 1) - .background( - Group { - if isPerformingTask { - DodamLoadingView() - } + .background { + if isPerformingTask { + DodamLoadingView() } - ) + } } } -#Preview { - VStack(alignment: .leading) { - let title = "Button" - let icon = Dodam.icon(.home) - let action: () async -> Void = { - try? await Task.sleep(nanoseconds: 1_000_000_000) +private struct ButtonPreview: View { + var body: some View { + VStack(alignment: .leading) { + let title = "로그인" + let icon = Dodam.icon(.home) + let action: () async -> Void = { + try? await Task.sleep(nanoseconds: 1_000_000_000) + } + DodamButton.fullWidth( + title: title, + leadingIcon: icon, + trailingIcon: icon, + action: action + ) + DodamButton.large( + title: title, + leadingIcon: icon, + trailingIcon: icon, + action: action + ) + DodamButton.medium( + title: title, + leadingIcon: icon, + action: action + ) + DodamButton.small( + title: title, + leadingIcon: icon, + action: action + ) } - DodamButton.fullWidth( - title: title, - icon: icon, - action: action - ) - DodamButton.large( - title: title, - icon: icon, - action: action - ) - DodamButton.medium( - title: title, - icon: icon, - action: action - ) - DodamButton.small( - title: title, - icon: icon, - action: action - ) + .padding() + .registerSUIT() } - .padding() - .registerSUIT() +} + +#Preview { + ButtonPreview() +} + +#Preview { + ButtonPreview() + .preferredColorScheme(.dark) } diff --git a/Source/DDS/Component/CheckBox/Checkbox.swift b/Source/DDS/Component/CheckBox/Checkbox.swift index 3d6fd11..6b78e22 100644 --- a/Source/DDS/Component/CheckBox/Checkbox.swift +++ b/Source/DDS/Component/CheckBox/Checkbox.swift @@ -9,13 +9,16 @@ public struct Checkbox: View { @Binding private var isChecked: Bool private let type: CheckType + private let isDisabled: Bool public init( isChecked: Binding, - type: CheckType = .primary + type: CheckType = .primary, + isDisabled: Bool = false ) { self._isChecked = isChecked self.type = type + self.isDisabled = isDisabled } public var body: some View { @@ -24,40 +27,44 @@ public struct Checkbox: View { } label: { Group { if isChecked { - ZStack { - Rectangle() - .dodamFill( - type == .primary - ? DodamColor.Primary.normal - : DodamColor.Status.negative - ) - .frame(width: 18, height: 18) - .clipShape(RoundedRectangle(cornerRadius: 4)) - Image(icon: .checkmark) - .resizable() - .foreground(DodamColor.Static.white) - .padding(4) - } + Image(icon: .checkmark) + .resizable() + .frame(width: 12, height: 12) + .foreground(DodamColor.Static.white) + .padding(4) + .background { + Rectangle() + .dodamFill( + type == .primary + ? DodamColor.Primary.normal + : DodamColor.Status.negative + ) + .frame(width: 18, height: 18) + .clipShape(RoundedRectangle(cornerRadius: 4)) + } } else { RoundedRectangle(cornerRadius: 4) .dodamStroke(DodamColor.Line.normal, lineWidth: 2) .frame(width: 18, height: 18) } } - .frame(width: 40, height: 40) + .padding(3) } + .frame(width: 40, height: 40) + .disabled(isDisabled) + .opacity(isDisabled ? 0.5 : 1) } } #Preview { struct CheckboxPreview: View { - @State var isChecked: Bool = true var body: some View { VStack(spacing: 20) { Checkbox(isChecked: $isChecked) Checkbox(isChecked: $isChecked, type: .error) + Checkbox(isChecked: $isChecked, isDisabled: true) } .padding(16) .background(DodamColor.Background.normal) diff --git a/Source/DDS/Component/Divider/Divider.swift b/Source/DDS/Component/Divider/Divider.swift new file mode 100644 index 0000000..8487471 --- /dev/null +++ b/Source/DDS/Component/Divider/Divider.swift @@ -0,0 +1,47 @@ +import SwiftUI + +public struct DodamDivider: View { + + public enum DividerType { + case line + case thick + + var size: CGFloat { + switch self { + case .line: 1 + case .thick: 8 + } + } + } + + private let type: DividerType + + public init(type: DividerType = .line) { + self.type = type + } + + public var body: some View { + Rectangle() + .dodamFill(DodamColor.Line.alternative) + .frame(maxWidth: .infinity) + .frame(height: type.size) + } +} + +private struct DodamDividerPreview: View { + var body: some View { + VStack { + DodamDivider(type: .line) + DodamDivider(type: .thick) + } + } +} + +#Preview { + DodamDividerPreview() +} + +#Preview { + DodamDividerPreview() + .preferredColorScheme(.dark) +} diff --git a/Source/DDS/Component/EmptyView/EmptyView.swift b/Source/DDS/Component/EmptyView/EmptyView.swift index bb6ff66..443ce55 100644 --- a/Source/DDS/Component/EmptyView/EmptyView.swift +++ b/Source/DDS/Component/EmptyView/EmptyView.swift @@ -26,7 +26,7 @@ public struct DodamEmptyView: View { Dodam.icon(icon) .frame(width: 36, height: 36) Text(title) - .font(.label(.large)) + .font(.label(.medium)) .foreground(DodamColor.Label.alternative) } DodamButton.fullWidth(title: buttonTitle) { diff --git a/Source/DDS/Component/NavigationView/NavigationView.swift b/Source/DDS/Component/NavigationView/NavigationView.swift index 11b399c..036ddf9 100644 --- a/Source/DDS/Component/NavigationView/NavigationView.swift +++ b/Source/DDS/Component/NavigationView/NavigationView.swift @@ -3,20 +3,20 @@ import SwiftUI @available(macOS 12, iOS 15, *) public struct DodamNavigationView: DodamNavigationViewProtocol { - public let navigationBar: DodamNavigationBar - public let buttons: [DodamNavigationBarButton] + public let topAppBar: DodamTopAppBar + public let buttons: [DodamTopAppBarButton] public let subView: AnyView? public let content: () -> C public static func makeView( borderSize: CGFloat? = nil, - navigationBar: DodamNavigationBar, - buttons: [DodamNavigationBarButton] = .init(), + topAppBar: DodamTopAppBar, + buttons: [DodamTopAppBarButton] = [], subView: AnyView? = nil, @ViewBuilder content: @escaping () -> C ) -> Self { .init( - navigationBar: navigationBar, + topAppBar: topAppBar, buttons: buttons, subView: subView, content: content @@ -25,7 +25,7 @@ public struct DodamNavigationView: DodamNavigationViewProtocol { public var body: some View { VStack(spacing: 0) { - applyBar(bar: navigationBar) + applyBar(bar: topAppBar) content() .frame(maxWidth: .infinity, maxHeight: .infinity) } diff --git a/Source/DDS/Component/NavigationView/NavigationViewProtocol.swift b/Source/DDS/Component/NavigationView/NavigationViewProtocol.swift index f6a6b72..3be71a0 100644 --- a/Source/DDS/Component/NavigationView/NavigationViewProtocol.swift +++ b/Source/DDS/Component/NavigationView/NavigationViewProtocol.swift @@ -5,15 +5,15 @@ public protocol DodamNavigationViewProtocol: View { associatedtype C: View - var navigationBar: DodamNavigationBar { get } - var buttons: [DodamNavigationBarButton] { get } + var topAppBar: DodamTopAppBar { get } + var buttons: [DodamTopAppBarButton] { get } var subView: AnyView? { get } var content: () -> C { get } static func makeView( borderSize: CGFloat?, - navigationBar: DodamNavigationBar, - buttons: [DodamNavigationBarButton], + topAppBar: DodamTopAppBar, + buttons: [DodamTopAppBarButton], subView: AnyView?, @ViewBuilder content: @escaping () -> C ) -> Self @@ -23,14 +23,14 @@ public extension DodamNavigationViewProtocol { static func makeView( borderSize: CGFloat? = nil, - navigationBar: DodamNavigationBar, - buttons: [DodamNavigationBarButton] = .init(), + topAppBar: DodamTopAppBar, + buttons: [DodamTopAppBarButton] = [], subView: AnyView? = nil, @ViewBuilder content: @escaping () -> C ) -> Self { makeView( borderSize: borderSize, - navigationBar: navigationBar, + topAppBar: topAppBar, buttons: buttons, subView: subView, content: content @@ -42,7 +42,7 @@ public extension DodamNavigationViewProtocol { @ViewBuilder content: @escaping () -> C ) -> Self { makeView( - navigationBar: .default(title: title), + topAppBar: .default(title: title), content: content ) } @@ -52,7 +52,7 @@ public extension DodamNavigationViewProtocol { @ViewBuilder content: @escaping () -> C ) -> Self { makeView( - navigationBar: .icon(icon: icon), + topAppBar: .icon(icon: icon), content: content ) } @@ -62,7 +62,7 @@ public extension DodamNavigationViewProtocol { @ViewBuilder content: @escaping () -> C ) -> Self { makeView( - navigationBar: .small(title: title), + topAppBar: .small(title: title), content: content ) } @@ -72,7 +72,7 @@ public extension DodamNavigationViewProtocol { @ViewBuilder content: @escaping () -> C ) -> Self { makeView( - navigationBar: .medium(title: title), + topAppBar: .medium(title: title), content: content ) } @@ -82,7 +82,7 @@ public extension DodamNavigationViewProtocol { @ViewBuilder content: @escaping () -> C ) -> Self { makeView( - navigationBar: .large(title: title), + topAppBar: .large(title: title), content: content ) } @@ -91,7 +91,7 @@ public extension DodamNavigationViewProtocol { @ViewBuilder content: @escaping () -> S ) -> Self { Self.makeView( - navigationBar: self.navigationBar, + topAppBar: self.topAppBar, buttons: self.buttons, subView: AnyView(content()), content: self.content @@ -105,7 +105,7 @@ public extension DodamNavigationViewProtocol { ) -> Self { guard !hidden else { return self } return Self.makeView( - navigationBar: self.navigationBar, + topAppBar: self.topAppBar, buttons: self.buttons + [ .init( icon: icon, @@ -118,9 +118,9 @@ public extension DodamNavigationViewProtocol { } func applyBar( - bar: DodamNavigationBar, + bar: DodamTopAppBar, index: Int = 0 - ) -> DodamNavigationBar { + ) -> DodamTopAppBar { if !buttons.isEmpty { let item = buttons[index] let result = bar diff --git a/Source/DDS/Component/CircularProgressView/CircularProgressView.swift b/Source/DDS/Component/ProgressIndicator/CircularProgressView.swift similarity index 100% rename from Source/DDS/Component/CircularProgressView/CircularProgressView.swift rename to Source/DDS/Component/ProgressIndicator/CircularProgressView.swift diff --git a/Source/DDS/Component/LinearProgressView/LinearProgressView.swift b/Source/DDS/Component/ProgressIndicator/LinearProgressView.swift similarity index 100% rename from Source/DDS/Component/LinearProgressView/LinearProgressView.swift rename to Source/DDS/Component/ProgressIndicator/LinearProgressView.swift diff --git a/Source/DDS/Component/ScrollView/ScrollView.swift b/Source/DDS/Component/ScrollView/ScrollView.swift index 3ade33f..16f7d9f 100644 --- a/Source/DDS/Component/ScrollView/ScrollView.swift +++ b/Source/DDS/Component/ScrollView/ScrollView.swift @@ -4,21 +4,21 @@ import SwiftUI public struct DodamScrollView: DodamNavigationViewProtocol { public let borderSize: CGFloat? - public let navigationBar: DodamNavigationBar - public let buttons: [DodamNavigationBarButton] + public let topAppBar: DodamTopAppBar + public let buttons: [DodamTopAppBarButton] public let subView: AnyView? public let content: () -> C public static func makeView( borderSize: CGFloat? = nil, - navigationBar: DodamNavigationBar, - buttons: [DodamNavigationBarButton] = .init(), + topAppBar: DodamTopAppBar, + buttons: [DodamTopAppBarButton] = [], subView: AnyView? = nil, @ViewBuilder content: @escaping () -> C ) -> Self { .init( borderSize: borderSize, - navigationBar: navigationBar, + topAppBar: topAppBar, buttons: buttons, subView: subView, content: content @@ -30,7 +30,7 @@ public struct DodamScrollView: DodamNavigationViewProtocol { ) -> Self { Self.makeView( borderSize: size, - navigationBar: self.navigationBar, + topAppBar: self.topAppBar, buttons: self.buttons, subView: self.subView, content: self.content @@ -76,7 +76,7 @@ public struct DodamScrollView: DodamNavigationViewProtocol { .ignoresSafeArea() } .safeAreaInset(edge: .top) { - applyBar(bar: navigationBar) + applyBar(bar: topAppBar) .background(.bar.opacity(blueOpacity)) } .safeAreaInset(edge: .bottom) { diff --git a/Source/DDS/Component/NavigationBar/NavigationBar.swift b/Source/DDS/Component/TopAppBar/TopAppBar.swift similarity index 91% rename from Source/DDS/Component/NavigationBar/NavigationBar.swift rename to Source/DDS/Component/TopAppBar/TopAppBar.swift index bbc2031..665fd37 100644 --- a/Source/DDS/Component/NavigationBar/NavigationBar.swift +++ b/Source/DDS/Component/TopAppBar/TopAppBar.swift @@ -1,7 +1,7 @@ import SwiftUI @available(macOS 12, iOS 15, *) -public struct DodamNavigationBar: View { +public struct DodamTopAppBar: View { private let title: String private let font: Font @@ -9,16 +9,16 @@ public struct DodamNavigationBar: View { private let verticalSpacing: CGFloat? private let showBackButton: Bool private let subView: AnyView? - private let buttons: [DodamNavigationBarButton] + private let buttons: [DodamTopAppBarButton] private init( title: String = "", - font: Font = .headline(.small), + font: Font = .title3(.bold), icon: DodamIconography? = nil, verticalSpacing: CGFloat? = nil, showBackButton: Bool = true, subView: AnyView? = nil, - buttons: [DodamNavigationBarButton] = .init() + buttons: [DodamTopAppBarButton] = [] ) { self.title = title self.font = font @@ -46,7 +46,7 @@ public struct DodamNavigationBar: View { public static func small(title: String) -> Self { .init( title: title, - font: .body(.large) + font: .headline(.bold) ) } @@ -60,7 +60,7 @@ public struct DodamNavigationBar: View { public static func large(title: String) -> Self { .init( title: title, - font: .headline(.medium), + font: .title2(.bold), verticalSpacing: 48 ) } @@ -173,22 +173,22 @@ public struct DodamNavigationBar: View { #Preview { VStack { Divider() - DodamNavigationBar.default(title: "Default") + DodamTopAppBar.default(title: "Default") .button(icon: .plus) { } .button(icon: .bell) { } Divider() - DodamNavigationBar.icon(icon: .logo) + DodamTopAppBar.icon(icon: .logo) .button(icon: .bell) { } Divider() - DodamNavigationBar.small(title: "Small") + DodamTopAppBar.small(title: "Small") .button(icon: .plus) { } .button(icon: .bell) { } Divider() - DodamNavigationBar.medium(title: "Medium") + DodamTopAppBar.medium(title: "Medium") .button(icon: .plus) { } .button(icon: .bell) { } Divider() - DodamNavigationBar.large(title: "Large") + DodamTopAppBar.large(title: "Large") .button(icon: .plus) { } .button(icon: .bell) { } Divider() diff --git a/Source/DDS/Component/NavigationBar/NavigationButton.swift b/Source/DDS/Component/TopAppBar/TopAppBarButton.swift similarity index 65% rename from Source/DDS/Component/NavigationBar/NavigationButton.swift rename to Source/DDS/Component/TopAppBar/TopAppBarButton.swift index 1dd64f0..129e83b 100644 --- a/Source/DDS/Component/NavigationBar/NavigationButton.swift +++ b/Source/DDS/Component/TopAppBar/TopAppBarButton.swift @@ -1,4 +1,4 @@ -public struct DodamNavigationBarButton { +public struct DodamTopAppBarButton { public let icon: DodamIconography public let action: () -> Void diff --git a/Source/DDS/Component/TopTabView/TopTabView.swift b/Source/DDS/Component/TopTabView/TopTabView.swift index 417706b..0cadb85 100644 --- a/Source/DDS/Component/TopTabView/TopTabView.swift +++ b/Source/DDS/Component/TopTabView/TopTabView.swift @@ -35,7 +35,7 @@ public struct DodamTopTabView: View { } label: { VStack(spacing: 12) { Text(string) - .font(.body(.large)) + .font(.headline(.medium)) .foreground(DodamColor.Label.normal) .opacity(isSelected ? 1 : 0.5) Group { @@ -78,20 +78,25 @@ public struct DodamTopTabView: View { } } -#Preview { - struct DodamTopTabPreview: View { - - @State private var selection: Int = 0 - - var body: some View { - DodamTopTabView(selection: $selection) { - Text("대기중") - .page(.text("대기중")) - Text("MY") - .page(.text("MY")) - } - .registerSUIT() +private struct DodamTopTabPreview: View { + @State private var selection: Int = 0 + + var body: some View { + DodamTopTabView(selection: $selection) { + Text("대기중") + .page(.text("대기중")) + Text("MY") + .page(.text("MY")) } + .registerSUIT() } - return DodamTopTabPreview() +} + +#Preview { + DodamTopTabPreview() +} + +#Preview { + DodamTopTabPreview() + .preferredColorScheme(.dark) } diff --git a/Source/DDS/Foundation/Dodam/Dodam.swift b/Source/DDS/Foundation/Dodam/Dodam.swift index 5d832b6..f2692fd 100644 --- a/Source/DDS/Foundation/Dodam/Dodam.swift +++ b/Source/DDS/Foundation/Dodam/Dodam.swift @@ -3,6 +3,8 @@ import SwiftUI @available(macOS 12, iOS 15, *) public struct Dodam { + private init() {} + public static func icon(_ icon: DodamIconography) -> Image { .init(icon: icon) } diff --git a/Source/DDS/Foundation/Iconography/Iconography.xcassets/Checkmark.imageset/checkmark.svg b/Source/DDS/Foundation/Iconography/Iconography.xcassets/Checkmark.imageset/checkmark.svg index 9615055..71fa4fc 100644 --- a/Source/DDS/Foundation/Iconography/Iconography.xcassets/Checkmark.imageset/checkmark.svg +++ b/Source/DDS/Foundation/Iconography/Iconography.xcassets/Checkmark.imageset/checkmark.svg @@ -1,3 +1,3 @@ - + diff --git a/Source/DDS/Foundation/Typography/Type/Body.swift b/Source/DDS/Foundation/Typography/Type/Body.swift index c0a6ab6..64a3f71 100644 --- a/Source/DDS/Foundation/Typography/Type/Body.swift +++ b/Source/DDS/Foundation/Typography/Type/Body.swift @@ -7,7 +7,7 @@ public struct DodamBody: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.5 - public static let large: Self = .init(weight: .bold) + public static let bold: Self = .init(weight: .bold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Caption1.swift b/Source/DDS/Foundation/Typography/Type/Caption1.swift index a0fc166..3c1a767 100644 --- a/Source/DDS/Foundation/Typography/Type/Caption1.swift +++ b/Source/DDS/Foundation/Typography/Type/Caption1.swift @@ -7,7 +7,7 @@ public struct DodamCaption1: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.3 - public static let large: Self = .init(weight: .bold) + public static let bold: Self = .init(weight: .bold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Caption2.swift b/Source/DDS/Foundation/Typography/Type/Caption2.swift index 24554e7..4d4eedb 100644 --- a/Source/DDS/Foundation/Typography/Type/Caption2.swift +++ b/Source/DDS/Foundation/Typography/Type/Caption2.swift @@ -7,7 +7,7 @@ public struct DodamCaption2: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.3 - public static let large: Self = .init(weight: .bold) + public static let bold: Self = .init(weight: .bold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Heading1.swift b/Source/DDS/Foundation/Typography/Type/Heading1.swift index ecf4be9..597a233 100644 --- a/Source/DDS/Foundation/Typography/Type/Heading1.swift +++ b/Source/DDS/Foundation/Typography/Type/Heading1.swift @@ -7,7 +7,7 @@ public struct DodamHeading1: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.3 - public static let large: Self = .init(weight: .extrabold) + public static let bold: Self = .init(weight: .extrabold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Heading2.swift b/Source/DDS/Foundation/Typography/Type/Heading2.swift index e598498..15ad645 100644 --- a/Source/DDS/Foundation/Typography/Type/Heading2.swift +++ b/Source/DDS/Foundation/Typography/Type/Heading2.swift @@ -7,7 +7,7 @@ public struct DodamHeading2: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.4 - public static let large: Self = .init(weight: .extrabold) + public static let bold: Self = .init(weight: .extrabold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Headline.swift b/Source/DDS/Foundation/Typography/Type/Headline.swift index b849c50..44b91b2 100644 --- a/Source/DDS/Foundation/Typography/Type/Headline.swift +++ b/Source/DDS/Foundation/Typography/Type/Headline.swift @@ -7,7 +7,7 @@ public struct DodamHeadline: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.5 - public static let large: Self = .init(weight: .extrabold) + public static let bold: Self = .init(weight: .extrabold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Label.swift b/Source/DDS/Foundation/Typography/Type/Label.swift index b4c9b9c..5047636 100644 --- a/Source/DDS/Foundation/Typography/Type/Label.swift +++ b/Source/DDS/Foundation/Typography/Type/Label.swift @@ -7,7 +7,7 @@ public struct DodamLabel: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.4 - public static let large: Self = .init(weight: .bold) + public static let bold: Self = .init(weight: .bold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Title1.swift b/Source/DDS/Foundation/Typography/Type/Title1.swift index 4b2b6df..26e590c 100644 --- a/Source/DDS/Foundation/Typography/Type/Title1.swift +++ b/Source/DDS/Foundation/Typography/Type/Title1.swift @@ -7,7 +7,7 @@ public struct DodamTitle1: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.3 - public static let large: Self = .init(weight: .extrabold) + public static let bold: Self = .init(weight: .extrabold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Title2.swift b/Source/DDS/Foundation/Typography/Type/Title2.swift index 4578bea..f04d7aa 100644 --- a/Source/DDS/Foundation/Typography/Type/Title2.swift +++ b/Source/DDS/Foundation/Typography/Type/Title2.swift @@ -7,7 +7,7 @@ public struct DodamTitle2: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.3 - public static let large: Self = .init(weight: .extrabold) + public static let bold: Self = .init(weight: .extrabold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) } diff --git a/Source/DDS/Foundation/Typography/Type/Title3.swift b/Source/DDS/Foundation/Typography/Type/Title3.swift index 0b0f1cf..29537a2 100644 --- a/Source/DDS/Foundation/Typography/Type/Title3.swift +++ b/Source/DDS/Foundation/Typography/Type/Title3.swift @@ -7,7 +7,7 @@ public struct DodamTitle3: DodamTypography { public let weight: SUIT.Weight public let lineHeight: Double = 1.3 - public static let large: Self = .init(weight: .extrabold) + public static let bold: Self = .init(weight: .extrabold) public static let medium: Self = .init(weight: .medium) - public static let small: Self = .init(weight: .regular) + public static let regular: Self = .init(weight: .regular) }