Skip to content

Commit

Permalink
Merge pull request #39 from payan-app/scaffold-fix
Browse files Browse the repository at this point in the history
fix: error view alignment fixed
  • Loading branch information
juandahurt authored Dec 17, 2022
2 parents 1567a7e + fe3146c commit bcf6d84
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
42 changes: 24 additions & 18 deletions Sources/Purace/Pages/Scaffold/PuraceErrorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,34 @@ struct PuraceErrorView: View {

var body: some View {
GeometryReader { _ in
VStack(alignment: .center) {
HStack {
Spacer(minLength: 0)
Image("error", bundle: .module)
VStack(spacing: 17) {
PuraceTextView("Ups", fontSize: 22, weight: .medium)
PuraceTextView("Parece que ha ocurrido un error. No te preocupes, es nuestra culpa.", fontSize: 14, textColor: PuraceStyle.Color.N2)
.multilineTextAlignment(.center)
HStack(spacing: 3) {
PuraceTextView("Código:", textColor: PuraceStyle.Color.N4)
PuraceTextView("12", weight: .medium)

VStack(alignment: .center) {
Spacer(minLength: 0)
Image("error", bundle: .module)
VStack(alignment: .center, spacing: 17) {
PuraceTextView("Ups", fontSize: 22, weight: .medium)
PuraceTextView("Parece que ha ocurrido un error. No te preocupes, es nuestra culpa.", fontSize: 14, textColor: PuraceStyle.Color.N2)
.multilineTextAlignment(.center)
HStack(spacing: 3) {
PuraceTextView("Código:", textColor: PuraceStyle.Color.N4)
PuraceTextView("12", weight: .medium)
}
.padding(.horizontal, 20)
.padding(.vertical, 4)
.background(Color.white)
.cornerRadius(20)
}
.padding(.horizontal, 20)
.padding(.vertical, 4)
.background(Color.white)
.cornerRadius(20)
}
Spacer(minLength: 0)
if let onRetryTap {
PuraceButtonView("Reintentar") {
onRetryTap()
Spacer(minLength: 0)
if let onRetryTap {
PuraceButtonView("Reintentar") {
onRetryTap()
}
}
Spacer(minLength: 0)
}

Spacer(minLength: 0)
}
.padding(.horizontal, 50)
Expand Down
22 changes: 13 additions & 9 deletions Sources/Purace/Pages/Scaffold/PuraceScaffoldNavBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import SwiftUI

public struct PuraceScaffoldNavBar: View {
var title: String
var showBackButton: Bool
var backOnTap: () -> Void

public init(title: String, backOnTap: @escaping () -> Void) {
public init(title: String, showBackButton: Bool = true, backOnTap: @escaping () -> Void) {
self.title = title
self.showBackButton = showBackButton
self.backOnTap = backOnTap
}

Expand All @@ -22,17 +24,19 @@ public struct PuraceScaffoldNavBar: View {
VStack(alignment: .center) {
Spacer(minLength: 0)
HStack(alignment: .center) {
Button {
backOnTap()
} label: {
Image("arrow_left", bundle: .module)
.foregroundColor(PuraceStyle.Color.N1)
}.frame(width: 20)
.buttonStyle(.plain)
if showBackButton {
Button {
backOnTap()
} label: {
Image("arrow_left", bundle: .module)
.foregroundColor(PuraceStyle.Color.N1)
}.frame(width: 20)
.buttonStyle(.plain)
}

Spacer(minLength: 0)

PuraceTextView(title, fontSize: 14, weight: .medium)
PuraceTextView(title, fontSize: 16, weight: .medium)
.multilineTextAlignment(.center)

Spacer(minLength: 0)
Expand Down

0 comments on commit bcf6d84

Please sign in to comment.