This commit is contained in:
Francisco Gindre 2021-10-27 16:29:23 -03:00
parent 2e49e0968d
commit 0877689d3a
7 changed files with 27 additions and 37 deletions

View File

@ -61,8 +61,8 @@ internal enum Asset {
internal static let gradientStart = ColorAsset(name: "gradientStart")
}
internal enum Shadow {
internal static let buttonTextShadow = ColorAsset(name: "buttonTextShadow")
internal static let emptyChipInnerShadow = ColorAsset(name: "emptyChipInnerShadow")
internal static let numberedTextShadow = ColorAsset(name: "numberedTextShadow")
}
internal enum Text {
internal static let activeButtonText = ColorAsset(name: "ActiveButtonText")

View File

@ -29,7 +29,8 @@ class AppRouter: Router {
// Add your content here
NavigationView {
AppRouterView(router: self)
}.onTapGesture(count: 10) {
}
.onTapGesture(count: 10) {
self.screen = .designGuide
}
}

View File

@ -18,14 +18,10 @@ struct BlueChip: View {
minHeight: 30,
idealHeight: 40
)
.foregroundColor(
Asset.Colors.Text.activeButtonText.color
)
.foregroundColor(Asset.Colors.Text.activeButtonText.color)
.padding(.horizontal, 4)
.padding(.vertical, 4)
.background(
Asset.Colors.Buttons.activeButton.color
)
.background(Asset.Colors.Buttons.activeButton.color)
.cornerRadius(6)
}
}

View File

@ -25,9 +25,7 @@ struct EnumeratedChip: View {
)
.padding(.horizontal, 16)
.padding(.vertical, 4)
.background(
Asset.Colors.Buttons.primaryButtonPressed.color
)
.background(Asset.Colors.Buttons.primaryButtonPressed.color)
.cornerRadius(6)
}
}
@ -38,31 +36,17 @@ struct NumberedText: View {
@ViewBuilder var numberedText: some View {
Text(number.superscriptRepresentation)
.foregroundColor(
Asset.Colors.Text.highlightedSuperscriptText.color
)
.font(
.custom(
FontFamily.Roboto.bold.name,
size: 20
)
) +
.foregroundColor(Asset.Colors.Text.highlightedSuperscriptText.color)
.font(.custom(FontFamily.Roboto.bold.name, size: 20)) +
Text(" \(text)")
.foregroundColor(
Asset.Colors.Text.button.color
)
.font(
.custom(
FontFamily.Rubik.medium.name,
size: 16
)
)
.foregroundColor(Asset.Colors.Text.button.color)
.font(.custom(FontFamily.Rubik.medium.name, size: 16))
}
var body: some View {
numberedText
.shadow(
color: Asset.Colors.Shadow.buttonTextShadow.color,
color: Asset.Colors.Shadow.numberedTextShadow.color,
radius: 1,
x: 0,
y: 1
@ -82,7 +66,7 @@ struct EnumeratedChip_Previews: PreviewProvider {
count: 3
)
static var words = [
private static var words = [
"pyramid", "negative", "page",
"crown", "", "zebra"
]
@ -115,13 +99,16 @@ struct EnumeratedChip_Previews: PreviewProvider {
}
.padding()
}
static var previews: some View {
grid
.background(Asset.Colors.BackgroundColors.phraseGridDarkGray.color)
.previewLayout(.fixed(width: 428, height: 200))
grid
.applyScreenBackground()
.previewLayout(.fixed(width: 428, height: 200))
grid
.applyScreenBackground()
.previewLayout(.fixed(width: 428, height: 200))

View File

@ -14,10 +14,10 @@ struct PhraseChip: View {
case ordered(position: Int, word: String)
}
@State var kind: Kind = .empty
var kind: Kind
var body: some View {
chipFor(kind)
chipFor(for: kind)
.frame(
minWidth: 0,
maxWidth: 120,
@ -27,12 +27,14 @@ struct PhraseChip: View {
.animation(.easeIn)
}
@ViewBuilder func chipFor(_ kind: Kind) -> some View {
@ViewBuilder func chipFor(for kind: Kind) -> some View {
switch kind {
case .empty:
EmptyChip()
case let .ordered(position, word):
EnumeratedChip(index: position, text: word)
case .unassigned(let word):
BlueChip(word: word)
}
@ -44,8 +46,10 @@ struct PhraseChip_Previews: PreviewProvider {
VStack {
PhraseChip(kind: .unassigned(word: "negative"))
.frame(height: 40)
PhraseChip(kind: .empty)
.frame(height: 40)
PhraseChip(kind: .ordered(position: 23, word: "mutual"))
.frame(height: 40)
}

View File

@ -8,9 +8,8 @@
import SwiftUI
struct DesignGuide: View {
let columns: [GridItem] = [
GridItem(.adaptive(minimum: 320, maximum: .infinity))
]
let columns = [GridItem(.adaptive(minimum: 320, maximum: .infinity))]
var body: some View {
ScrollView {
LazyVGrid(columns: columns) {
@ -51,6 +50,7 @@ struct TextAndPlaceholdersGuide: View {
struct SmallVisualElements: View {
let gridItems = [GridItem(.flexible(minimum: 40, maximum: 100)), GridItem(.flexible(minimum: 40, maximum: 100))]
var body: some View {
VStack {
Text("Navigation Buttons")
@ -90,6 +90,7 @@ struct SmallVisualElements: View {
struct ButtonGuide: View {
let buttonHeight: CGFloat = 60
var body: some View {
VStack(spacing: 30) {
// Idle Primary Button
@ -152,6 +153,7 @@ struct ButtonGuide: View {
}
}
}
struct DesignGuide_Previews: PreviewProvider {
static var previews: some View {
DesignGuide()