txtodo

[DORMANT] a minimalist todo list app inspired by jeff huang
git clone git://git.figbert.com/txtodo.git
Log | Files | Refs | README

MenuView.swift (1669B)


      1 //
      2 //  MenuView.swift
      3 //  txtodo (iOS)
      4 //
      5 //  Created by FIGBERT on 8/6/20.
      6 //
      7 
      8 import SwiftUI
      9 
     10 struct MenuView: View {
     11     @State private var config = MenuViewConfig()
     12     @StateObject var storeManager: StoreManager
     13     
     14     var body: some View {
     15         HStack {
     16             VStack(alignment: .leading, spacing: 18) {
     17                 if config.active {
     18                     Label("settings", systemImage: "gear")
     19                         .onTapGesture {
     20                             config.showSettings = true
     21                         }
     22                         .sheet(isPresented: $config.showSettings) {
     23                             SettingsSheet(storeManager: storeManager)
     24                         }
     25                     Label("about", systemImage: "book")
     26                         .onTapGesture {
     27                             config.showAbout = true
     28                         }
     29                         .sheet(isPresented: $config.showAbout) {
     30                             AboutSheet()
     31                         }
     32                 }
     33                 Image(systemName: config.active ? "chevron.up" : "line.horizontal.3")
     34                     .font(.system(size: 30, weight: .ultraLight))
     35                     .onTapGesture {
     36                         config.active.toggle()
     37                     }
     38             }
     39             Spacer()
     40         }
     41             .font(.system(size: 18, weight: .light))
     42             .padding()
     43     }
     44 }
     45 
     46 struct MenuViewConfig {
     47     var active: Bool = false
     48     var showSettings: Bool = false
     49     var showAbout: Bool = false
     50 }
     51 
     52 struct MenuView_Previews: PreviewProvider {
     53     static var previews: some View {
     54         MenuView(storeManager: StoreManager())
     55     }
     56 }