Skip to content

Commit

Permalink
Format and updates for macOS (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 authored Dec 25, 2024
1 parent 9de4f8d commit 079841d
Show file tree
Hide file tree
Showing 35 changed files with 1,084 additions and 828 deletions.
36 changes: 21 additions & 15 deletions Example/Shared/DemoPages/GridSelectDemo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,30 @@ struct GridSelectDemo: View {
PageView("Grid select") {
VStack(spacing: .xSmall) {
ScrollView {
GridSelect(items, selection: $selection,
content: { item, _ in
VStack {
IconDeprecated(.circle)
Text(item)
}.padding()
})
GridSelect(
items,
selection: $selection,
content: { item, _ in
VStack {
IconDeprecated(.circle)
Text(item)
}.padding()
}
)
}

GridSelect(items2, selection: $selection,
content: { item, _ in
VStack {
IconDeprecated(.circle)
Text(item)
}.padding()
})
GridSelect(
items2,
selection: $selection,
content: { item, _ in
VStack {
IconDeprecated(.circle)
Text(item)
}.padding()
}
)

.gridSelectStyle(SelectionOnlyGridSelectStyle())
.gridSelectStyle(SelectionOnlyGridSelectStyle())
}
.padding()
}
Expand Down
9 changes: 5 additions & 4 deletions Sources/OversizeUI/Controls/Background/Background.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ public struct Background<Content: View>: View {
private let background: BackgroundColor
public var padding: BackgroundPadding

public init(background: BackgroundColor = .primary,
padding: BackgroundPadding = .medium,
@ViewBuilder content: () -> Content)
{
public init(
background: BackgroundColor = .primary,
padding: BackgroundPadding = .medium,
@ViewBuilder content: () -> Content
) {
self.content = content()
self.padding = padding
self.background = background
Expand Down
26 changes: 15 additions & 11 deletions Sources/OversizeUI/Controls/Badge/Bage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ public struct Bage<Label: View>: View {
.padding(.vertical, .xxxSmall)
.padding(.horizontal, .xxSmall)
.background(
RoundedRectangle(cornerRadius: controlRadius,
style: .continuous)
.fill(color.opacity(0.1))
.overlay(
RoundedRectangle(cornerRadius: controlRadius,
style: .continuous)
.stroke(
theme.borderSurface
? Color.border
: Color.clear
)
RoundedRectangle(
cornerRadius: controlRadius,
style: .continuous
)
.fill(color.opacity(0.1))
.overlay(
RoundedRectangle(
cornerRadius: controlRadius,
style: .continuous
)
.stroke(
theme.borderSurface
? Color.border
: Color.clear
)
)
)
}
}
35 changes: 24 additions & 11 deletions Sources/OversizeUI/Controls/Button/FieldButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,44 @@ public struct FieldButtonStyle: ButtonStyle {
.fill(isPressed ? Color.surfaceTertiary : Color.surfaceSecondary)
.overlay(
RoundedRectangleCorner(radius: Radius.medium, corners: backgroundShapeCorners)
.stroke(theme.borderTextFields
? Color.border
: Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize))
.stroke(
theme.borderTextFields
? Color.border
: Color.surfaceSecondary,
lineWidth: CGFloat(theme.borderSize)
)
)
#else
RoundedRectangle(cornerRadius: Radius.medium, style: .continuous)
.fill(isPressed ? Color.surfaceTertiary : Color.surfaceSecondary)
.overlay(
RoundedRectangle(cornerRadius: Radius.medium,
style: .continuous)
.stroke(theme.borderTextFields
RoundedRectangle(
cornerRadius: Radius.medium,
style: .continuous
)
.stroke(
theme.borderTextFields
? Color.border
: Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize))
: Color.surfaceSecondary,
lineWidth: CGFloat(theme.borderSize)
)
)
#endif

default:
RoundedRectangle(cornerRadius: Radius.medium, style: .continuous)
.fill(isPressed ? Color.surfaceTertiary : Color.surfaceSecondary)
.overlay(
RoundedRectangle(cornerRadius: Radius.medium,
style: .continuous)
.stroke(theme.borderTextFields
RoundedRectangle(
cornerRadius: Radius.medium,
style: .continuous
)
.stroke(
theme.borderTextFields
? Color.border
: Color.surfaceSecondary, lineWidth: CGFloat(theme.borderSize))
: Color.surfaceSecondary,
lineWidth: CGFloat(theme.borderSize)
)
)
}
}
Expand Down
22 changes: 12 additions & 10 deletions Sources/OversizeUI/Controls/Checkbox/Checkbox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ public struct Checkbox<Label: View>: View {
private var title: String?
private let action: (() -> Void)?

public init(isOn: Binding<Bool>,
alignment: CheckboxAlignment = .trailing,
action: (() -> Void)? = nil,
@ViewBuilder label: @escaping () -> Label? = { nil })
{
public init(
isOn: Binding<Bool>,
alignment: CheckboxAlignment = .trailing,
action: (() -> Void)? = nil,
@ViewBuilder label: @escaping () -> Label? = { nil }
) {
_isOn = isOn
self.alignment = alignment
self.action = action
Expand Down Expand Up @@ -102,11 +103,12 @@ public struct Checkbox<Label: View>: View {
}

public extension Checkbox where Label == EmptyView {
init(_ title: String,
isOn: Binding<Bool>,
alignment: CheckboxAlignment = .trailing,
action: (() -> Void)? = nil)
{
init(
_ title: String,
isOn: Binding<Bool>,
alignment: CheckboxAlignment = .trailing,
action: (() -> Void)? = nil
) {
self.title = title
_isOn = isOn
self.alignment = alignment
Expand Down
10 changes: 7 additions & 3 deletions Sources/OversizeUI/Controls/ColorSelector/ColorSelector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,13 @@ public struct ColorPickerWithoutBorder: View {
.cornerRadius(19.0)
.background(
ZStack {
AngularGradient(gradient: Gradient(colors:
[.red, .yellow, .green, .blue, .purple, .red]),
center: .center, startAngle: .zero, endAngle: .degrees(360)).cornerRadius(16)
AngularGradient(
gradient: Gradient(colors:
[.red, .yellow, .green, .blue, .purple, .red]),
center: .center,
startAngle: .zero,
endAngle: .degrees(360)
).cornerRadius(16)
.frame(width: 32, height: 32)

Circle()
Expand Down
16 changes: 9 additions & 7 deletions Sources/OversizeUI/Controls/ContentView/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ public struct ContentView: View {
private let primaryButton: ContenButtonType?
private let secondaryButton: ContenButtonType?

public init(image: Image? = nil,
title: String,
subtitle: String? = nil,
primaryButton: ContenButtonType? = nil,
secondaryButton: ContenButtonType? = nil)
{
public init(
image: Image? = nil,
title: String,
subtitle: String? = nil,
primaryButton: ContenButtonType? = nil,
secondaryButton: ContenButtonType? = nil
) {
self.image = image
self.title = title
self.subtitle = subtitle
Expand All @@ -45,7 +46,8 @@ public struct ContentView: View {
VStack(alignment: vStackAlignment, spacing: .large) {
if let image {
image
.frame(width: 218, height: 218, alignment: .bottom)
.resizable()
.frame(width: 128, height: 128, alignment: .bottom)
}

TextBox(
Expand Down
Loading

0 comments on commit 079841d

Please sign in to comment.