build iOS study scaffold
This commit is contained in:
@@ -5,6 +5,8 @@ struct HermesApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
RootView()
|
||||
.preferredColorScheme(.dark)
|
||||
.tint(HermesTheme.accent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,64 @@
|
||||
import SwiftUI
|
||||
|
||||
struct RootView: View {
|
||||
@StateObject private var localization = LocalizationStore()
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
VStack(spacing: 16) {
|
||||
Text("Hermes")
|
||||
.font(.largeTitle.bold())
|
||||
Text("Native study app scaffold")
|
||||
.font(.body)
|
||||
.foregroundStyle(.secondary)
|
||||
OnboardingView()
|
||||
ScrollView {
|
||||
VStack(alignment: .leading, spacing: 24) {
|
||||
header
|
||||
OnboardingView()
|
||||
FeedView()
|
||||
RoundView()
|
||||
}
|
||||
.padding(.horizontal, HermesTheme.screenPadding)
|
||||
.padding(.vertical, 24)
|
||||
}
|
||||
.padding()
|
||||
.navigationTitle("Hermes")
|
||||
.background(HermesTheme.background.ignoresSafeArea())
|
||||
.navigationTitle(localization.string(for: "app.name"))
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
}
|
||||
.environmentObject(localization)
|
||||
}
|
||||
|
||||
private var header: some View {
|
||||
HStack(alignment: .top) {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
Text(localization.string(for: "app.name"))
|
||||
.font(.largeTitle.bold())
|
||||
.foregroundStyle(HermesTheme.textPrimary)
|
||||
Text(localization.string(for: "app.subtitle"))
|
||||
.font(.callout)
|
||||
.foregroundStyle(HermesTheme.textSecondary)
|
||||
}
|
||||
|
||||
Spacer(minLength: 12)
|
||||
|
||||
localeToggle
|
||||
}
|
||||
}
|
||||
|
||||
private var localeToggle: some View {
|
||||
HStack(spacing: 8) {
|
||||
localeButton(title: "EN", localeCode: "en")
|
||||
localeButton(title: "SV", localeCode: "sv")
|
||||
}
|
||||
}
|
||||
|
||||
private func localeButton(title: String, localeCode: String) -> some View {
|
||||
let isSelected = localization.localeCode == localeCode
|
||||
|
||||
return Button {
|
||||
localization.setLocale(localeCode)
|
||||
} label: {
|
||||
Text(title)
|
||||
.font(.caption.weight(.bold))
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 8)
|
||||
.foregroundStyle(isSelected ? HermesTheme.background : HermesTheme.textPrimary)
|
||||
.background(isSelected ? HermesTheme.accent : HermesTheme.surfaceElevated)
|
||||
.clipShape(Capsule())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user