Skip to content

Commit

Permalink
Small improvements for components and move modules in other packages
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Sep 6, 2022
1 parent 581bb41 commit 427f6dd
Show file tree
Hide file tree
Showing 62 changed files with 975 additions and 1,565 deletions.
2 changes: 1 addition & 1 deletion .swiftpm/xcode/xcshareddata/xcschemes/OversizeUI.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
LastUpgradeVersion = "1340"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 1 addition & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ let package = Package(
],
products: [
.library(
name: "OversizeUI",
targets: ["OversizeUI"]
name: "OversizeUI", targets: ["OversizeUI"]
),
],
dependencies: [],
Expand Down
4 changes: 2 additions & 2 deletions Sources/OversizeUI/Controls/Badge/Bage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public struct Bage<Label: View>: View {
.padding(.vertical, .xxxSmall)
.padding(.horizontal, 6)
.background(
RoundedRectangle(cornerRadius: controlRadius.rawValue,
RoundedRectangle(cornerRadius: controlRadius,
style: .circular)
.fill(color.opacity(0.1))
.overlay(
RoundedRectangle(cornerRadius: controlRadius.rawValue,
RoundedRectangle(cornerRadius: controlRadius,
style: .continuous)
.stroke(
theme.borderSurface
Expand Down
44 changes: 23 additions & 21 deletions Sources/OversizeUI/Controls/Button/Button.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,28 @@ public struct OversizeButtonStyle: ButtonStyle {

@ViewBuilder
func background(for role: ButtonRole?) -> some View {
switch controlBorderShape {
case .capsule:
Capsule()
.fill(backgroundColor(for: role)
.opacity(backgroundOpacity))
.overlay {
Capsule()
.strokeBorder(Color.onSurfaceHighEmphasis.opacity(0.15), lineWidth: 2)
.opacity(isBordered || theme.borderButtons ? 1 : 0)
}
if type != .tertiary {
switch controlBorderShape {
case .capsule:
Capsule()
.fill(backgroundColor(for: role)
.opacity(backgroundOpacity))
.overlay {
Capsule()
.strokeBorder(Color.onSurfaceHighEmphasis.opacity(0.15), lineWidth: 2)
.opacity(isBordered || theme.borderButtons ? 1 : 0)
}

case let .roundedRectangle(radius):
RoundedRectangle(cornerRadius: radius != .medium ? radius.rawValue : theme.radius, style: .continuous)
.fill(backgroundColor(for: role)
.opacity(backgroundOpacity))
.overlay {
RoundedRectangle(cornerRadius: radius != .medium ? radius.rawValue : theme.radius, style: .continuous)
.strokeBorder(Color.onSurfaceHighEmphasis.opacity(0.15), lineWidth: 2)
.opacity(isBordered || theme.borderButtons ? 1 : 0)
}
case let .roundedRectangle(radius):
RoundedRectangle(cornerRadius: radius != .medium ? radius.rawValue : theme.radius, style: .continuous)
.fill(backgroundColor(for: role)
.opacity(backgroundOpacity))
.overlay {
RoundedRectangle(cornerRadius: radius != .medium ? radius.rawValue : theme.radius, style: .continuous)
.strokeBorder(Color.onSurfaceHighEmphasis.opacity(0.15), lineWidth: 2)
.opacity(isBordered || theme.borderButtons ? 1 : 0)
}
}
}
}

Expand Down Expand Up @@ -104,7 +106,7 @@ public struct OversizeButtonStyle: ButtonStyle {
if isAccent {
return Color.accent
} else {
return Color.primary
return Color.onSurfaceHighEmphasis
}
}
case .tertiary:
Expand All @@ -115,7 +117,7 @@ public struct OversizeButtonStyle: ButtonStyle {
if isAccent {
return Color.accent
} else {
return Color.primary
return Color.onSurfaceHighEmphasis
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/OversizeUI/Controls/Button/ButtonLegacy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,22 +284,22 @@ public struct ButtonStyleExtended: ButtonStyle {
public extension Button {
/// Changes the appearance of the button

@available(*, deprecated, message: "Use native buttonStyle")
// @available(*, deprecated, message: "Use native buttonStyle")
func style(_ style: LegacyButtonType) -> some View {
buttonStyle(ButtonStyleExtended(style: style))
}

@available(*, deprecated, message: "Use native buttonStyle")
// @available(*, deprecated, message: "Use native buttonStyle")
func style(_ style: LegacyButtonType, size: ButtonSize) -> some View {
buttonStyle(ButtonStyleExtended(style: style, size: size))
}

@available(*, deprecated, message: "Use native buttonStyle")
// @available(*, deprecated, message: "Use native buttonStyle")
func style(_ style: LegacyButtonType, size: ButtonSize, shadow: Bool) -> some View {
buttonStyle(ButtonStyleExtended(style: style, size: size, shadow: shadow))
}

@available(*, deprecated, message: "Use native buttonStyle")
// @available(*, deprecated, message: "Use native buttonStyle")
func style(_ style: LegacyButtonType, size: ButtonSize, rounded: ButtonRounded, width: ButtonWidth = .standart, shadow: Bool) -> some View {
buttonStyle(ButtonStyleExtended(style: style, size: size, rounded: rounded, width: width, shadow: shadow))
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/OversizeUI/Controls/GridSelect/GridSelect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ public struct GridSelect<Element: Equatable, Content, Selection>: View
private func getSelection(selectionStyle: GridSelectSeletionStyle) -> some View {
switch selectionStyle {
case .shadowSurface:
RoundedRectangle(cornerRadius: radius.rawValue,
RoundedRectangle(cornerRadius: radius,
style: .continuous)
.fill(Color.surfacePrimary)
.overlay(
RoundedRectangle(cornerRadius: radius.rawValue,
RoundedRectangle(cornerRadius: radius,
style: .continuous)
.stroke(theme.borderControls
? Color.border
Expand All @@ -119,7 +119,7 @@ public struct GridSelect<Element: Equatable, Content, Selection>: View
.shadowElevaton(.z2)
case .graySurface:

RoundedRectangle(cornerRadius: radius.rawValue,
RoundedRectangle(cornerRadius: radius,
style: .continuous)
.strokeBorder(Color.onSurfaceMediumEmphasis, lineWidth: 2)
case .accentSurface:
Expand All @@ -136,11 +136,11 @@ public struct GridSelect<Element: Equatable, Content, Selection>: View
EmptyView()
case .surface:

RoundedRectangle(cornerRadius: radius.rawValue,
RoundedRectangle(cornerRadius: radius,
style: .continuous)
.fill(Color.surfaceSecondary)
.overlay(
RoundedRectangle(cornerRadius: radius.rawValue,
RoundedRectangle(cornerRadius: radius,
style: .continuous)
.stroke(theme.borderControls
? Color.border
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeUI/Controls/HUD/HUD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public struct HUDSurfaceView<Content: View>: View {
return AnyShape(Capsule())

case .alert:
return AnyShape(RoundedRectangle(cornerRadius: Radius.medium.rawValue, style: .continuous))
return AnyShape(RoundedRectangle(cornerRadius: Radius.medium, style: .continuous))
}
}

Expand Down
13 changes: 7 additions & 6 deletions Sources/OversizeUI/Controls/Icon/Icon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ public struct Icon: View {

public var body: some View {
Image(name.rawValue, bundle: .module)
.renderingMode(.template)
.resizable()
.frame(width: iconSize, height: iconSize)
.foregroundColor(color)
Expand Down Expand Up @@ -367,12 +368,12 @@ struct IconAsset_Previews: PreviewProvider {
.buttonStyle(.borderedProminent)
.controlSize(.large)

// LazyVGrid(columns: grid) {
// ForEach(IconsNames.allCases, id: \.self) { icon in
// Icon(icon)
// .padding(.vertical)
// }
// }
LazyVGrid(columns: grid) {
ForEach(IconsNames.allCases, id: \.self) { icon in
Icon(icon)
.padding(.vertical)
}
}
.padding()
.previewLayout(.sizeThatFits)
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/OversizeUI/Controls/IconPicker/IconPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ import SwiftUI
.frame(minWidth: 0, maxWidth: .infinity)
.padding()
.background(
RoundedRectangle(cornerRadius: Radius.medium.rawValue,
RoundedRectangle(cornerRadius: Radius.medium,
style: .continuous)
.fill(Color.surfaceSecondary)
.overlay(
RoundedRectangle(cornerRadius: Radius.medium.rawValue,
RoundedRectangle(cornerRadius: Radius.medium,
style: .continuous)
.stroke(theme.borderTextFields
? Color.border
Expand Down Expand Up @@ -90,7 +90,7 @@ import SwiftUI
.frame(width: 24, height: 24, alignment: .center)
}
.overlay(
RoundedRectangle(cornerRadius: Radius.medium.rawValue, style: .continuous)
RoundedRectangle(cornerRadius: Radius.medium, style: .continuous)
.strokeBorder(Color.border, lineWidth: 1)
.frame(width: 48, height: 48, alignment: .center)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ import SwiftUI
.frame(minWidth: 0, maxWidth: .infinity)
.padding()
.background(
RoundedRectangle(cornerRadius: Radius.medium.rawValue,
RoundedRectangle(cornerRadius: Radius.medium,
style: .continuous)
.fill(Color.surfaceSecondary)
.overlay(
RoundedRectangle(cornerRadius: Radius.medium.rawValue,
RoundedRectangle(cornerRadius: Radius.medium,
style: .continuous)
.stroke(theme.borderTextFields
? Color.border
Expand Down
Loading

0 comments on commit 427f6dd

Please sign in to comment.