Skip to content

Commit bcf6d84

Browse files
authored
Merge pull request #39 from payan-app/scaffold-fix
fix: error view alignment fixed
2 parents 1567a7e + fe3146c commit bcf6d84

File tree

2 files changed

+37
-27
lines changed

2 files changed

+37
-27
lines changed

Sources/Purace/Pages/Scaffold/PuraceErrorView.swift

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,34 @@ struct PuraceErrorView: View {
1212

1313
var body: some View {
1414
GeometryReader { _ in
15-
VStack(alignment: .center) {
15+
HStack {
1616
Spacer(minLength: 0)
17-
Image("error", bundle: .module)
18-
VStack(spacing: 17) {
19-
PuraceTextView("Ups", fontSize: 22, weight: .medium)
20-
PuraceTextView("Parece que ha ocurrido un error. No te preocupes, es nuestra culpa.", fontSize: 14, textColor: PuraceStyle.Color.N2)
21-
.multilineTextAlignment(.center)
22-
HStack(spacing: 3) {
23-
PuraceTextView("Código:", textColor: PuraceStyle.Color.N4)
24-
PuraceTextView("12", weight: .medium)
17+
18+
VStack(alignment: .center) {
19+
Spacer(minLength: 0)
20+
Image("error", bundle: .module)
21+
VStack(alignment: .center, spacing: 17) {
22+
PuraceTextView("Ups", fontSize: 22, weight: .medium)
23+
PuraceTextView("Parece que ha ocurrido un error. No te preocupes, es nuestra culpa.", fontSize: 14, textColor: PuraceStyle.Color.N2)
24+
.multilineTextAlignment(.center)
25+
HStack(spacing: 3) {
26+
PuraceTextView("Código:", textColor: PuraceStyle.Color.N4)
27+
PuraceTextView("12", weight: .medium)
28+
}
29+
.padding(.horizontal, 20)
30+
.padding(.vertical, 4)
31+
.background(Color.white)
32+
.cornerRadius(20)
2533
}
26-
.padding(.horizontal, 20)
27-
.padding(.vertical, 4)
28-
.background(Color.white)
29-
.cornerRadius(20)
30-
}
31-
Spacer(minLength: 0)
32-
if let onRetryTap {
33-
PuraceButtonView("Reintentar") {
34-
onRetryTap()
34+
Spacer(minLength: 0)
35+
if let onRetryTap {
36+
PuraceButtonView("Reintentar") {
37+
onRetryTap()
38+
}
3539
}
40+
Spacer(minLength: 0)
3641
}
42+
3743
Spacer(minLength: 0)
3844
}
3945
.padding(.horizontal, 50)

Sources/Purace/Pages/Scaffold/PuraceScaffoldNavBar.swift

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import SwiftUI
1010

1111
public struct PuraceScaffoldNavBar: View {
1212
var title: String
13+
var showBackButton: Bool
1314
var backOnTap: () -> Void
1415

15-
public init(title: String, backOnTap: @escaping () -> Void) {
16+
public init(title: String, showBackButton: Bool = true, backOnTap: @escaping () -> Void) {
1617
self.title = title
18+
self.showBackButton = showBackButton
1719
self.backOnTap = backOnTap
1820
}
1921

@@ -22,17 +24,19 @@ public struct PuraceScaffoldNavBar: View {
2224
VStack(alignment: .center) {
2325
Spacer(minLength: 0)
2426
HStack(alignment: .center) {
25-
Button {
26-
backOnTap()
27-
} label: {
28-
Image("arrow_left", bundle: .module)
29-
.foregroundColor(PuraceStyle.Color.N1)
30-
}.frame(width: 20)
31-
.buttonStyle(.plain)
27+
if showBackButton {
28+
Button {
29+
backOnTap()
30+
} label: {
31+
Image("arrow_left", bundle: .module)
32+
.foregroundColor(PuraceStyle.Color.N1)
33+
}.frame(width: 20)
34+
.buttonStyle(.plain)
35+
}
3236

3337
Spacer(minLength: 0)
3438

35-
PuraceTextView(title, fontSize: 14, weight: .medium)
39+
PuraceTextView(title, fontSize: 16, weight: .medium)
3640
.multilineTextAlignment(.center)
3741

3842
Spacer(minLength: 0)

0 commit comments

Comments
 (0)