Skip to content

Commit

Permalink
Pbselect (#2)
Browse files Browse the repository at this point in the history
* revert deprecated

* pbselect

* gitignore

* xcode file
  • Loading branch information
evertoncunha authored Jun 14, 2022
1 parent 0f68c8b commit c4aca8a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.swiftpm/xcode/package.xcworkspace/xcuserdata
.swiftpm/xcode/xcuserdata
Package.resolved
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions Sources/Playbook/PBSelect.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//
// PBSelect.swift
//
//
// Created by Everton Cunha on 14/06/22.
//

import SwiftUI

public struct PBSelect: ButtonStyle {

let title: String

let style: PBCardStyle

public init(_ title: String, style: PBCardStyle) {
self.title = title
self.style = style
}

public func makeBody(configuration: Configuration) -> some View {
VStack(alignment: .leading, spacing: 4) {
if let title = title {
Text(title)
.pbFont(.caption, color: .pbTextLight)
}
PBCard(padding: 0, style: style) {
HStack {
configuration.label
.frame(height: 44)
.pbFont(.body)
Spacer()
PBIcon.fontAwesome(.chevronDown)
}
.padding(.horizontal, .pbSmall)
}
}
}
}

struct PBSelect_Previews: PreviewProvider {
static var previews: some View {
registerFonts()
return Group {
Button("Burguers") {

}
.buttonStyle(PBSelect("FAVORITE FOOD", style: .default))
.preferredColorScheme(.light)
}
}
}
2 changes: 1 addition & 1 deletion Sources/Playbook/Typography/Font+Playbook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public enum PBTextStyle {
}

extension Font {
@available(*, deprecated, message: "use .font(.pbBody)")

public static func pb(_ style: PBTextStyle) -> Font {
return style.font
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Playbook/Typography/Typography.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public extension Typography {
}

public extension View {
@available(*, deprecated, message: "use .font(.pbBody)")

func pbFont(_ style: PBTextStyle,
variant: Typography.Variant = .none,
color: Color = .pbTextDefault) -> some View {
Expand Down

0 comments on commit c4aca8a

Please # to comment.