Skip to content

Commit

Permalink
Fix LocalizedStringKey initializers
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelHolec committed Sep 5, 2024
1 parent ccc0d63 commit 6d8e539
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Sources/Orbit/Components/Alert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public extension Alert where Title == Heading, Description == Text, Icon == Orbi
/// Creates Orbit ``Alert`` component with localizable texts.
@_semantics("swiftui.init_with_localization")
init(
_ title: LocalizedStringKey,
_ title: LocalizedStringKey = "",
description: LocalizedStringKey = "",
icon: Icon.Symbol? = nil,
isSubtle: Bool = false,
Expand Down
16 changes: 8 additions & 8 deletions Sources/Orbit/Components/ButtonLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ public extension ButtonLink where Label == Text, LeadingIcon == Orbit.Icon, Trai
@_semantics("swiftui.init_with_localization")
init(
_ label: LocalizedStringKey,
type: ButtonLinkType = .primary,
icon: Icon.Symbol? = nil,
disclosureIcon: Icon.Symbol? = nil,
type: ButtonLinkType = .primary,
tableName: String? = nil,
bundle: Bundle? = nil,
comment: StaticString? = nil,
Expand Down Expand Up @@ -173,7 +173,7 @@ struct ButtonLinkPreviews: PreviewProvider {
VStack(alignment: .leading, spacing: 0) {
ButtonLink("ButtonLink", icon: .grid, action: {})
.buttonSize(.regular)
ButtonLink("ButtonLink", type: .critical, icon: .grid, disclosureIcon: .grid, action: {})
ButtonLink("ButtonLink", icon: .grid, disclosureIcon: .grid, type: .critical, action: {})
.buttonSize(.regular)
ButtonLink("ButtonLink", action: {})

Expand Down Expand Up @@ -225,8 +225,8 @@ struct ButtonLinkPreviews: PreviewProvider {
ButtonLink("ButtonLink Critical", type: .critical, action: {})
}
VStack(alignment: .leading, spacing: .large) {
ButtonLink("ButtonLink Primary", type: .primary, icon: .accommodation, action: {})
ButtonLink("ButtonLink Critical", type: .critical, icon: .alertCircle, action: {})
ButtonLink("ButtonLink Primary", icon: .accommodation, type: .primary, action: {})
ButtonLink("ButtonLink Critical", icon: .alertCircle, type: .critical, action: {})
}
}
.buttonSize(.compact)
Expand All @@ -236,10 +236,10 @@ struct ButtonLinkPreviews: PreviewProvider {

static var statuses: some View {
VStack(alignment: .leading, spacing: .large) {
ButtonLink("ButtonLink Info", type: .status(.info), icon: .informationCircle, action: {})
ButtonLink("ButtonLink Success", type: .status(.success), icon: .checkCircle, action: {})
ButtonLink("ButtonLink Warning", type: .status(.warning), icon: .alert, action: {})
ButtonLink("ButtonLink Critical", type: .status(.critical), icon: .alertCircle, action: {})
ButtonLink("ButtonLink Info", icon: .informationCircle, type: .status(.info) , action: {})
ButtonLink("ButtonLink Success", icon: .checkCircle, type: .status(.success), action: {})
ButtonLink("ButtonLink Warning", icon: .alert, type: .status(.warning), action: {})
ButtonLink("ButtonLink Critical", icon: .alertCircle, type: .status(.critical), action: {})
}
.buttonSize(.compact)
.padding(.medium)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Orbit/Components/Heading.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public extension Heading {
/// Creates Orbit ``Heading`` component.
@_disfavoredOverload
init(
_ content: some StringProtocol = String(""),
_ content: some StringProtocol,
style: Style
) {
self.init(Text(content), style: style)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Orbit/Components/Tag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public extension Tag where Label == Text, Icon == Orbit.Icon {
/// Creates Orbit ``Tag`` component.
@_disfavoredOverload
init(
_ label: some StringProtocol,
_ label: some StringProtocol = String(""),
icon: Icon.Symbol? = nil,
isFocused: Bool = true,
isSelected: Binding<Bool>,
Expand All @@ -132,7 +132,7 @@ public extension Tag where Label == Text, Icon == Orbit.Icon {
/// Creates Orbit ``Tag`` component with localizable label.
@_semantics("swiftui.init_with_localization")
init(
_ label: LocalizedStringKey,
_ label: LocalizedStringKey = "",
icon: Icon.Symbol? = nil,
isFocused: Bool = true,
isSelected: Binding<Bool>,
Expand Down
6 changes: 3 additions & 3 deletions Sources/Orbit/Support/Components/TimelineItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ public extension TimelineItem where Label == Heading, Sublabel == Text, Descript
/// Creates Orbit ``TimelineItem`` component with localizable texts.
@_semantics("swiftui.init_with_localization")
init(
_ label: LocalizedStringKey,
sublabel: LocalizedStringKey,
description: LocalizedStringKey,
_ label: LocalizedStringKey = "",
sublabel: LocalizedStringKey = "",
description: LocalizedStringKey = "",
type: TimelineItemType,
tableName: String? = nil,
bundle: Bundle? = nil,
Expand Down
12 changes: 6 additions & 6 deletions Sources/OrbitStorybook/Detail/Items/StorybookButtonLink.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ struct StorybookButtonLink {
ButtonLink("ButtonLink Critical", type: .critical, action: {})
}
VStack(alignment: .leading, spacing: .large) {
ButtonLink("ButtonLink Primary", type: .primary, icon: .accommodation, action: {})
ButtonLink("ButtonLink Critical", type: .critical, icon: .alertCircle, action: {})
ButtonLink("ButtonLink Primary", icon: .accommodation, type: .primary, action: {})
ButtonLink("ButtonLink Critical", icon: .alertCircle, type: .critical, action: {})
}
}
.buttonSize(.compact)
Expand All @@ -20,10 +20,10 @@ struct StorybookButtonLink {

static var status: some View {
VStack(alignment: .leading, spacing: .large) {
ButtonLink("ButtonLink Info", type: .status(.info), icon: .informationCircle, action: {})
ButtonLink("ButtonLink Success", type: .status(.success), icon: .checkCircle, action: {})
ButtonLink("ButtonLink Warning", type: .status(.warning), icon: .alert, action: {})
ButtonLink("ButtonLink Critical", type: .status(.critical), icon: .alertCircle, action: {})
ButtonLink("ButtonLink Info", icon: .informationCircle, type: .status(.info), action: {})
ButtonLink("ButtonLink Success", icon: .checkCircle, type: .status(.success), action: {})
ButtonLink("ButtonLink Warning", icon: .alert, type: .status(.warning), action: {})
ButtonLink("ButtonLink Critical", icon: .alertCircle, type: .status(.critical), action: {})
}
.buttonSize(.compact)
.previewDisplayName()
Expand Down

0 comments on commit 6d8e539

Please sign in to comment.