built out themes a bit more
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Theme.swift
|
||||
// theme.currentTheme.swift
|
||||
// Feels (iOS)
|
||||
//
|
||||
// Created by Trey Tartt on 2/4/22.
|
||||
@@ -7,65 +7,93 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
enum Theme: Int, CaseIterable {
|
||||
struct ThemeConstants {
|
||||
static let iconSize: CGFloat = 50
|
||||
}
|
||||
|
||||
enum Theme: Int, CaseIterable {
|
||||
case system
|
||||
case ifeelTheme
|
||||
case iFeel
|
||||
|
||||
var title: String {
|
||||
switch self {
|
||||
case .system:
|
||||
return SystemTheme.title
|
||||
case .iFeel:
|
||||
return IFeelTheme.title
|
||||
}
|
||||
}
|
||||
|
||||
var currentTheme: Themeable {
|
||||
switch self {
|
||||
|
||||
case .system:
|
||||
return "System"
|
||||
case .ifeelTheme:
|
||||
return "iFeel Theme"
|
||||
}
|
||||
}
|
||||
|
||||
var secondaryBGColor: UIColor {
|
||||
switch self{
|
||||
case .system:
|
||||
return UIColor.secondarySystemBackground
|
||||
case .ifeelTheme:
|
||||
return UIColor.systemBackground
|
||||
}
|
||||
}
|
||||
|
||||
var bg: some View {
|
||||
switch self {
|
||||
case .system:
|
||||
return AnyView(
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color(UIColor.systemBackground))
|
||||
}
|
||||
)
|
||||
case .ifeelTheme:
|
||||
return AnyView(
|
||||
BGView().equatable()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
var preview: some View {
|
||||
switch self {
|
||||
case .system:
|
||||
return AnyView(
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color(UIColor.secondarySystemBackground))
|
||||
.frame(width: Theme.iconSize, height: Theme.iconSize)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||
}
|
||||
)
|
||||
case .ifeelTheme:
|
||||
return AnyView(
|
||||
ZStack {
|
||||
BGView().equatable()
|
||||
.frame(width: Theme.iconSize, height: Theme.iconSize)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||
}
|
||||
)
|
||||
return SystemTheme()
|
||||
case .iFeel:
|
||||
return IFeelTheme()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protocol Themeable {
|
||||
static var title: String { get }
|
||||
var secondaryBGColor: UIColor { get }
|
||||
var bg: AnyView { get }
|
||||
var preview: AnyView { get }
|
||||
}
|
||||
|
||||
struct IFeelTheme: Themeable {
|
||||
static var title: String {
|
||||
return "iFeel Theme"
|
||||
}
|
||||
|
||||
var secondaryBGColor: UIColor {
|
||||
return UIColor.systemBackground
|
||||
}
|
||||
|
||||
var bg: AnyView {
|
||||
return AnyView(
|
||||
BGView().equatable()
|
||||
)
|
||||
}
|
||||
|
||||
var preview: AnyView {
|
||||
return AnyView(
|
||||
ZStack {
|
||||
BGView().equatable()
|
||||
.frame(width: ThemeConstants.iconSize, height: ThemeConstants.iconSize)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct SystemTheme: Themeable {
|
||||
static var title: String {
|
||||
return "System"
|
||||
}
|
||||
|
||||
var secondaryBGColor: UIColor {
|
||||
return UIColor.secondarySystemBackground
|
||||
}
|
||||
|
||||
var bg: AnyView {
|
||||
return AnyView(
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color(UIColor.systemBackground))
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
var preview: AnyView {
|
||||
return AnyView(
|
||||
ZStack {
|
||||
Rectangle()
|
||||
.fill(Color(UIColor.secondarySystemBackground))
|
||||
.frame(width: ThemeConstants.iconSize, height: ThemeConstants.iconSize)
|
||||
.clipShape(RoundedRectangle(cornerRadius: 25, style: .continuous))
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user