Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions TabNews.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
objectVersion = 77;
objects = {

/* Begin PBXBuildFile section */
4A0C9F4B2EE7A14100A85E22 /* DesignSystem in Frameworks */ = {isa = PBXBuildFile; productRef = 4A0C9F4A2EE7A14100A85E22 /* DesignSystem */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
896D06FA2EDFD3DB0019833A /* TabNews.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TabNews.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
Expand All @@ -23,6 +27,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4A0C9F4B2EE7A14100A85E22 /* DesignSystem in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -65,6 +70,7 @@
);
name = TabNews;
packageProductDependencies = (
4A0C9F4A2EE7A14100A85E22 /* DesignSystem */,
);
productName = TabNews;
productReference = 896D06FA2EDFD3DB0019833A /* TabNews.app */;
Expand Down Expand Up @@ -94,6 +100,9 @@
);
mainGroup = 896D06F12EDFD3DB0019833A;
minimizedProjectReferenceProxies = 1;
packageReferences = (
4A0C9F492EE7A14100A85E22 /* XCLocalSwiftPackageReference "../../XCodeProjects/DesignSystem" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = 896D06FB2EDFD3DB0019833A /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -332,6 +341,20 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
4A0C9F492EE7A14100A85E22 /* XCLocalSwiftPackageReference "../../XCodeProjects/DesignSystem" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = ../../XCodeProjects/DesignSystem;
};
/* End XCLocalSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
4A0C9F4A2EE7A14100A85E22 /* DesignSystem */ = {
isa = XCSwiftPackageProductDependency;
productName = DesignSystem;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 896D06F22EDFD3DB0019833A /* Project object */;
}
19 changes: 10 additions & 9 deletions TabNews/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import DesignSystem

struct HomeView: View {
@ObservedObject var authViewModel: AuthViewModel
Expand Down Expand Up @@ -53,7 +54,7 @@ struct HomeView: View {
Button {
showingLoginSheet = true
} label: {
HStack(spacing: 4) {
HStack(spacing: .space.x2) {
Image(systemName: "person.circle")
Text("Entrar")
}
Expand Down Expand Up @@ -90,7 +91,7 @@ private extension HomeView {
}

func loadingView() -> some View {
VStack(spacing: 12) {
VStack(spacing: .space.x6) {
ProgressView()
Text("Carregando conteúdos...")
.font(.subheadline)
Expand All @@ -99,14 +100,14 @@ private extension HomeView {
}

func errorView(with errorMessage: String) -> some View {
VStack(spacing: 16) {
VStack(spacing: .space.x8) {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.orange)
.font(.largeTitle)
Text(errorMessage)
.multilineTextAlignment(.center)
.foregroundColor(.primary)

Button("Tentar novamente") {
Task { await homeViewModel.loadContents() }
}
Expand All @@ -117,22 +118,22 @@ private extension HomeView {
}

func contentRow(index: Int, content: ContentResponse) -> some View {
HStack(alignment: .top, spacing: 12) {
HStack(alignment: .top, spacing: .space.x6) {
Text("\(index).")
.font(.headline)
.foregroundColor(.secondary)
VStack(alignment: .leading, spacing: 6) {

VStack(alignment: .leading, spacing: .space.x3) {
Text(content.title)
.font(.headline)
.foregroundColor(.primary)

Text(rowSubtitle(for: content))
.font(.footnote)
.foregroundColor(.secondary)
}
}
.padding(.vertical, 8)
.padding(.vertical, .space.x4)
}

func rowSubtitle(for content: ContentResponse) -> String {
Expand Down
35 changes: 18 additions & 17 deletions TabNews/Views/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import SwiftUI
import DesignSystem

struct LoginView: View {
@ObservedObject var authViewModel: AuthViewModel
Expand All @@ -23,10 +24,10 @@ struct LoginView: View {
.ignoresSafeArea()

ScrollView {
VStack(spacing: 24) {
VStack(spacing: 12) {
VStack(spacing: .space.x12) {
VStack(spacing: .space.x6) {
Image(systemName: "newspaper.fill")
.font(.system(size: 60))
.font(.system(size: .fontSize.xl9))
.foregroundColor(.blue)

Text("TabNews")
Expand All @@ -37,11 +38,11 @@ struct LoginView: View {
.font(.subheadline)
.foregroundColor(.secondary)
}
.padding(.top, 40)
.padding(.bottom, 20)
VStack(spacing: 16) {
VStack(alignment: .leading, spacing: 8) {
.padding(.top, .space.x20)
.padding(.bottom, .space.x10)

VStack(spacing: .space.x8) {
VStack(alignment: .leading, spacing: .space.x4) {
Text("Email")
.font(.subheadline)
.fontWeight(.medium)
Expand All @@ -51,7 +52,7 @@ struct LoginView: View {
.textFieldStyle(.plain)
.padding()
.background(Color(.systemBackground))
.cornerRadius(10)
.cornerRadius(.radius.x5)
.textContentType(.emailAddress)
.keyboardType(.emailAddress)
.autocapitalization(.none)
Expand All @@ -61,8 +62,8 @@ struct LoginView: View {
focusedField = .password
}
}
VStack(alignment: .leading, spacing: 8) {

VStack(alignment: .leading, spacing: .space.x4) {
Text("Senha")
.font(.subheadline)
.fontWeight(.medium)
Expand All @@ -72,7 +73,7 @@ struct LoginView: View {
.textFieldStyle(.plain)
.padding()
.background(Color(.systemBackground))
.cornerRadius(10)
.cornerRadius(.radius.x5)
.textContentType(.password)
.focused($focusedField, equals: .password)
.submitLabel(.go)
Expand All @@ -92,8 +93,8 @@ struct LoginView: View {
.foregroundColor(.red)
.padding()
.frame(maxWidth: .infinity, alignment: .leading)
.background(Color.red.opacity(0.1))
.cornerRadius(10)
.background(Color.red.opacity(.opacity.level1))
.cornerRadius(.radius.x5)
}

Button(action: {
Expand All @@ -113,13 +114,13 @@ struct LoginView: View {
}
.frame(maxWidth: .infinity)
.padding()
.background(authViewModel.isLoading ? Color.blue.opacity(0.6) : Color.blue)
.background(authViewModel.isLoading ? Color.blue.opacity(.opacity.level6) : Color.blue)
.foregroundColor(.white)
.cornerRadius(10)
.cornerRadius(.radius.x5)
}
.disabled(authViewModel.isLoading)
}
.padding(.horizontal, 24)
.padding(.horizontal, .space.x12)

Spacer()
}
Expand Down