-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from DroidKaigi/MrSmart00/feature/sponsors
Add Sponsor feature with KMP
- Loading branch information
Showing
6 changed files
with
170 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"sourceLanguage" : "en", | ||
"strings" : { | ||
"GOLD SPONSORS" : { | ||
|
||
}, | ||
"PLATINUM SPONSORS" : { | ||
|
||
}, | ||
"Sponsor" : { | ||
"localizations" : { | ||
"ja" : { | ||
"stringUnit" : { | ||
"state" : "translated", | ||
"value" : "スポンサー" | ||
} | ||
} | ||
} | ||
}, | ||
"SUPPORTERS" : { | ||
|
||
} | ||
}, | ||
"version" : "1.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,87 @@ | ||
import ComposableArchitecture | ||
import SwiftUI | ||
import Theme | ||
|
||
public struct SponsorView: View { | ||
private let store: StoreOf<SponsorReducer> | ||
@State var selectedSponsorData: SponsorData? | ||
|
||
public init(store: StoreOf<SponsorReducer>) { | ||
self.store = store | ||
} | ||
|
||
public var body: some View { | ||
Text(store.text) | ||
.onAppear { | ||
store.send(.onAppear) | ||
ScrollView { | ||
LazyVStack { | ||
Text("PLATINUM SPONSORS") | ||
.textStyle(.headlineSmall) | ||
.foregroundStyle(AssetColors.Primary.primaryFixed.swiftUIColor) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
|
||
ForEach(store.platinums, id: \.id) { platinum in | ||
Button { | ||
selectedSponsorData = platinum | ||
} label: { | ||
AsyncImage(url: platinum.logo) { | ||
$0.image? | ||
.resizable() | ||
.scaledToFit() | ||
} | ||
.frame(height: 110) | ||
} | ||
} | ||
|
||
Text("GOLD SPONSORS") | ||
.textStyle(.headlineSmall) | ||
.foregroundStyle(AssetColors.Primary.primaryFixed.swiftUIColor) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
|
||
LazyVGrid(columns: Array(repeating: .init(.fixed(184)), count: 2)) { | ||
ForEach(store.golds, id: \.id) { gold in | ||
Button { | ||
selectedSponsorData = gold | ||
} label: { | ||
AsyncImage(url: gold.logo) { | ||
$0.image? | ||
.resizable() | ||
.scaledToFit() | ||
} | ||
.frame(height: 80) | ||
} | ||
} | ||
} | ||
|
||
Text("SUPPORTERS") | ||
.textStyle(.headlineSmall) | ||
.foregroundStyle(AssetColors.Primary.primaryFixed.swiftUIColor) | ||
.frame(maxWidth: .infinity, alignment: .leading) | ||
|
||
LazyVGrid(columns: Array(repeating: .init(.fixed(118)), count: 3)) { | ||
ForEach(store.supporters, id: \.id) { supporter in | ||
Button { | ||
selectedSponsorData = supporter | ||
} label: { | ||
AsyncImage(url: supporter.logo) { | ||
$0.image? | ||
.resizable() | ||
.scaledToFit() | ||
} | ||
.frame(height: 80) | ||
} | ||
} | ||
} | ||
} | ||
.padding(16) | ||
} | ||
.background(AssetColors.Surface.surface.swiftUIColor) | ||
.onAppear { | ||
store.send(.onAppear) | ||
} | ||
.navigationBarTitleDisplayMode(.large) | ||
.navigationTitle(String(localized: "Sponsor", bundle: .module)) | ||
} | ||
} | ||
|
||
#Preview { | ||
SponsorView(store: .init(initialState: .init(text: "Hoge"), reducer: { SponsorReducer() })) | ||
SponsorView(store: .init(initialState: .init(), reducer: { SponsorReducer() })) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters