ios: pin Sybil navigation theme
This commit is contained in:
@@ -4,8 +4,9 @@ public struct SplitView: View {
|
|||||||
@State private var viewModel = SybilViewModel()
|
@State private var viewModel = SybilViewModel()
|
||||||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
||||||
|
|
||||||
public init() {
|
@MainActor public init() {
|
||||||
SybilFontRegistry.registerIfNeeded()
|
SybilFontRegistry.registerIfNeeded()
|
||||||
|
SybilTheme.applySystemAppearance()
|
||||||
}
|
}
|
||||||
|
|
||||||
public var body: some View {
|
public var body: some View {
|
||||||
@@ -33,6 +34,7 @@ public struct SplitView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.font(.sybil(.body))
|
.font(.sybil(.body))
|
||||||
|
.preferredColorScheme(.dark)
|
||||||
.task {
|
.task {
|
||||||
await viewModel.bootstrap()
|
await viewModel.bootstrap()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ extension Theme {
|
|||||||
.text {
|
.text {
|
||||||
FontFamily(.custom("Inter"))
|
FontFamily(.custom("Inter"))
|
||||||
FontSize(15)
|
FontSize(15)
|
||||||
|
ForegroundColor(SybilTheme.text)
|
||||||
}
|
}
|
||||||
.code {
|
.code {
|
||||||
FontFamilyVariant(.monospaced)
|
FontFamilyVariant(.monospaced)
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ struct SybilPhoneShellView: View {
|
|||||||
.navigationTitle("")
|
.navigationTitle("")
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
.toolbar {
|
.toolbar {
|
||||||
ToolbarItem(placement: .principal) {
|
ToolbarItem(placement: .topBarLeading) {
|
||||||
SybilWordmark(size: 19)
|
SybilWordmark(size: 18)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.navigationDestination(for: PhoneRoute.self) { route in
|
.navigationDestination(for: PhoneRoute.self) { route in
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ struct SybilSidebarView: View {
|
|||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
VStack(alignment: .leading, spacing: 14) {
|
VStack(alignment: .leading, spacing: 14) {
|
||||||
SybilWordmark(size: 31)
|
|
||||||
|
|
||||||
VStack(spacing: 10) {
|
VStack(spacing: 10) {
|
||||||
sidebarActionButton(
|
sidebarActionButton(
|
||||||
title: "New chat",
|
title: "New chat",
|
||||||
@@ -174,6 +172,13 @@ struct SybilSidebarView: View {
|
|||||||
.padding(10)
|
.padding(10)
|
||||||
}
|
}
|
||||||
.background(SybilTheme.panelGradient)
|
.background(SybilTheme.panelGradient)
|
||||||
|
.navigationTitle("")
|
||||||
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
|
.toolbar {
|
||||||
|
ToolbarItem(placement: .topBarLeading) {
|
||||||
|
SybilWordmark(size: 18)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func sidebarActionButton(
|
private func sidebarActionButton(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import CoreText
|
import CoreText
|
||||||
import Foundation
|
import Foundation
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
import UIKit
|
||||||
|
|
||||||
enum SybilFontRegistry {
|
enum SybilFontRegistry {
|
||||||
static func registerIfNeeded() {
|
static func registerIfNeeded() {
|
||||||
@@ -78,6 +79,23 @@ enum SybilTheme {
|
|||||||
static let userBubble = Color(red: 0.29, green: 0.13, blue: 0.65)
|
static let userBubble = Color(red: 0.29, green: 0.13, blue: 0.65)
|
||||||
static let danger = Color(red: 0.96, green: 0.32, blue: 0.40)
|
static let danger = Color(red: 0.96, green: 0.32, blue: 0.40)
|
||||||
|
|
||||||
|
@MainActor static func applySystemAppearance() {
|
||||||
|
let navAppearance = UINavigationBarAppearance()
|
||||||
|
navAppearance.configureWithOpaqueBackground()
|
||||||
|
navAppearance.backgroundColor = UIColor(red: 0.02, green: 0.02, blue: 0.05, alpha: 1)
|
||||||
|
navAppearance.shadowColor = UIColor(red: 0.24, green: 0.20, blue: 0.38, alpha: 0.9)
|
||||||
|
navAppearance.titleTextAttributes = [
|
||||||
|
.foregroundColor: UIColor(red: 0.96, green: 0.94, blue: 1.0, alpha: 1)
|
||||||
|
]
|
||||||
|
navAppearance.largeTitleTextAttributes = navAppearance.titleTextAttributes
|
||||||
|
|
||||||
|
UINavigationBar.appearance().prefersLargeTitles = false
|
||||||
|
UINavigationBar.appearance().standardAppearance = navAppearance
|
||||||
|
UINavigationBar.appearance().compactAppearance = navAppearance
|
||||||
|
UINavigationBar.appearance().scrollEdgeAppearance = navAppearance
|
||||||
|
UINavigationBar.appearance().compactScrollEdgeAppearance = navAppearance
|
||||||
|
}
|
||||||
|
|
||||||
static var backgroundGradient: LinearGradient {
|
static var backgroundGradient: LinearGradient {
|
||||||
LinearGradient(
|
LinearGradient(
|
||||||
colors: [
|
colors: [
|
||||||
|
|||||||
Reference in New Issue
Block a user