summaryrefslogtreecommitdiff
path: root/JuickNext/View/ContentView.swift
blob: 22e74e0ecd1fcb8a4fb6e4ad29a1e7f5ae5ec02f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
//  ContentView.swift
//  Juick
//
//  Created by Vitaly Takmazov on 14.05.2023.
//  Copyright © 2023 com.juick. All rights reserved.
//

import SwiftUI

struct ContentView: View {
    @Environment(\.horizontalSizeClass) private var size
    
    let today = FeedView("Today", url: "https://api.juick.com/messages?popular=1")
    let discussions = FeedView("Discussions", url: "https://api.juick.com/messages/discussions")
    let discover = FeedView("Discover", url: "https://api.juick.com/messages")
    var body: some View {
        let view = (size == .compact) ?
        AnyView(TabView {
            today.tabItem {
                    Image("ei-clock")
                }
            discussions.tabItem {
                    Image("ei-bell")
                }
            discover.tabItem {
                    Image("Discover")
                }
        }): AnyView(NavigationView {
            VStack {
                Text("Discussions")
                Text("Discover")
                Text("Chats")
            }
        })
        view
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        NavigationView {
            ContentView()
        }
    }
}