-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SwiftUIContributorView #162
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,11 @@ public struct RootView: View { | |
} | ||
} | ||
.tint(AssetColors.Custom.flamingo.swiftUIColor) | ||
.navigationBarTitleStyle( | ||
color: AssetColors.Surface.onSurface.swiftUIColor, | ||
titleTextStyle: .titleMedium, | ||
largeTitleTextStyle: .headlineSmall | ||
) | ||
Comment on lines
+82
to
+86
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is custom modifier. |
||
} | ||
|
||
@MainActor | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to share these strings between iOS and Android? We should move to a shared location if that is possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it was decided whether to share Resource between iOS and Android. |
||
"sourceLanguage" : "en", | ||
"strings" : { | ||
"" : { | ||
|
||
}, | ||
"Contributor" : { | ||
"localizations" : { | ||
"en" : { | ||
"stringUnit" : { | ||
"state" : "translated", | ||
"value" : "Contributor" | ||
} | ||
}, | ||
"ja" : { | ||
"stringUnit" : { | ||
"state" : "translated", | ||
"value" : "コントリビューター" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"version" : "1.0" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import SwiftUI | ||
import ComposableArchitecture | ||
import Theme | ||
|
||
struct SwiftUIContributorView: View { | ||
private let store: StoreOf<ContributorReducer> | ||
|
||
public init(store: StoreOf<ContributorReducer>) { | ||
self.store = store | ||
} | ||
|
||
var body: some View { | ||
Group { | ||
if let contributors = store.contributors { | ||
ScrollView { | ||
LazyVStack(spacing: 0) { | ||
ForEach(contributors, id: \.id) { contributor in | ||
Button { | ||
if let urlString = contributor.profileUrl, | ||
let url = URL(string: urlString) { | ||
store.send(.view(.contributorButtonTapped(url))) | ||
} | ||
} label: { | ||
HStack(alignment: .center, spacing: 12) { | ||
AsyncImage(url: URL(string: contributor.iconUrl)) { | ||
$0.image?.resizable() | ||
} | ||
.frame(width: 52, height: 52) | ||
.clipShape(Circle()) | ||
|
||
Text(contributor.username) | ||
.textStyle(.bodyLarge) | ||
.foregroundStyle(AssetColors.Surface.onSurface.swiftUIColor) | ||
.multilineTextAlignment(.leading) | ||
.lineLimit(2) | ||
|
||
Spacer() | ||
|
||
} | ||
.frame(maxWidth: .infinity) | ||
.padding(.init(top: 12, leading: 16, bottom: 12, trailing: 16)) | ||
} | ||
} | ||
} | ||
} | ||
} else { | ||
ProgressView() | ||
.task { | ||
store.send(.onAppear) | ||
} | ||
} | ||
} | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.background(AssetColors.Surface.surface.swiftUIColor) | ||
} | ||
} | ||
|
||
#Preview { | ||
SwiftUIContributorView(store: .init(initialState: .init(), reducer: { ContributorReducer() })) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Foundation | ||
|
||
public struct IdentifiableURL: Identifiable { | ||
public let id: URL | ||
|
||
public init(_ id: URL) { | ||
self.id = id | ||
} | ||
} | ||
|
||
extension IdentifiableURL: Equatable {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import SwiftUI | ||
|
||
extension View { | ||
public func navigationBarTitleStyle(color: Color, titleTextStyle: TextStyle, largeTitleTextStyle: TextStyle) -> some View { | ||
let uiColor = UIColor(color) | ||
UINavigationBar.appearance().titleTextAttributes = [ | ||
.foregroundColor: uiColor, | ||
.font: titleTextStyle.font | ||
] | ||
UINavigationBar.appearance().largeTitleTextAttributes = [ | ||
.foregroundColor: uiColor, | ||
.font: largeTitleTextStyle.font | ||
] | ||
return self | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo