100 lines
3.4 KiB
Swift
100 lines
3.4 KiB
Swift
import SwiftUI
|
|
|
|
struct EntryBrand: View {
|
|
var prominent = false
|
|
|
|
var body: some View {
|
|
let size: CGFloat = prominent ? 46 : 32
|
|
HStack(spacing: prominent ? 12 : 9) {
|
|
Image("BrandMark")
|
|
.resizable()
|
|
.frame(width: size, height: size)
|
|
.clipShape(.rect(cornerRadius: prominent ? 12 : 8))
|
|
.accessibilityHidden(true)
|
|
Text("见物").font(prominent ? .largeTitle.weight(.bold) : .headline)
|
|
}
|
|
.accessibilityElement(children: .combine)
|
|
.accessibilityAddTraits(prominent ? .isHeader : [])
|
|
}
|
|
}
|
|
|
|
extension Color {
|
|
static func entryBackground(for scheme: ColorScheme) -> Color {
|
|
scheme == .dark ? Color(uiColor: .systemBackground) : Color(red: 0.976, green: 0.969, blue: 0.951)
|
|
}
|
|
}
|
|
|
|
struct WelcomeView: View {
|
|
let account: AtlasAccount
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
|
|
var body: some View {
|
|
ScrollView {
|
|
VStack(alignment: .leading, spacing: 22) {
|
|
EntryBrand(prominent: true)
|
|
scene
|
|
example
|
|
}
|
|
.frame(maxWidth: 460, alignment: .leading)
|
|
.padding(.horizontal, 24)
|
|
.padding(.top, 21)
|
|
.padding(.bottom, 24)
|
|
.frame(maxWidth: .infinity, alignment: .top)
|
|
}
|
|
.safeAreaInset(edge: .bottom, spacing: 0) {
|
|
signInLink
|
|
.frame(maxWidth: 460)
|
|
.padding(.horizontal, 24)
|
|
.padding(.vertical, 12)
|
|
.frame(maxWidth: .infinity)
|
|
.background(Color.entryBackground(for: colorScheme))
|
|
}
|
|
.background(Color.entryBackground(for: colorScheme).ignoresSafeArea())
|
|
.toolbar(.hidden, for: .navigationBar)
|
|
}
|
|
|
|
private var example: some View {
|
|
HStack(alignment: .center, spacing: 13) {
|
|
Image(systemName: "waveform")
|
|
.font(.body.weight(.semibold))
|
|
.foregroundStyle(Color.atlasBlue)
|
|
.frame(width: 36, height: 36)
|
|
.background(Color.atlasBlue.opacity(0.10), in: .rect(cornerRadius: 10))
|
|
.accessibilityHidden(true)
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text("数据线放在书房抽屉").font(.headline)
|
|
Text("说一句,见物帮你记下。").font(.subheadline).foregroundStyle(.secondary)
|
|
}
|
|
.accessibilityElement(children: .combine)
|
|
}
|
|
.padding(14)
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.background(Color(uiColor: .secondarySystemGroupedBackground), in: .rect(cornerRadius: 15))
|
|
}
|
|
|
|
private var signInLink: some View {
|
|
NavigationLink {
|
|
SignInView(account: account)
|
|
} label: {
|
|
HStack(spacing: 9) {
|
|
Text("进入我的空间")
|
|
Image(systemName: "arrow.right").accessibilityHidden(true)
|
|
}
|
|
.font(.body.weight(.semibold))
|
|
.frame(maxWidth: .infinity, minHeight: 29)
|
|
}
|
|
.buttonStyle(.borderedProminent)
|
|
.buttonBorderShape(.roundedRectangle(radius: 15))
|
|
.controlSize(.large)
|
|
}
|
|
|
|
private var scene: some View {
|
|
Image("WelcomeTray")
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(maxWidth: .infinity)
|
|
.clipShape(.rect(cornerRadius: 21))
|
|
.accessibilityHidden(true)
|
|
}
|
|
}
|