Files
damus/damus/Views/CarouselView.swift
William Casarin 07f3685762 Revert "home: fix carousel spacing issue"
This reverts commit 60e0031f25.
2022-11-18 12:45:45 -08:00

61 lines
1.8 KiB
Swift
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// CarouselView.swift
// damus
//
// Created by William Casarin on 2022-05-20.
//
import SwiftUI
struct CarouselItem: Identifiable {
let image: Image
let text: Text
let id = UUID().uuidString
}
let carousel_items = [
CarouselItem(image: Image("digital-nomad"), text: Text("Welcome to the social network \(Text("you").italic()) control.")),
CarouselItem(image: Image("encrypted-message"),
text: Text("\(Text("Encrypted").bold()). End-to-End encrypted private messaging. Keep Big Tech out of your DMs")),
CarouselItem(image: Image("undercover"),
text: Text("\(Text("Private").bold()). Creating an account doesn't require a phone number, email or name. Get started right away with zero friction.")),
CarouselItem(image: Image("bitcoin-p2p"),
text: Text("\(Text("Earn Money").bold()). Tip your friend's posts and stack sats with Bitcoin⚡, the native currency of the internet."))
]
struct CarouselView: View {
var body: some View {
TabView {
ForEach(carousel_items) { item in
CarouselItemView(item: item)
.tabItem {
Text(item.id)
}
}
}
.tabViewStyle(PageTabViewStyle())
}
}
func CarouselText(_ txt: String) -> some View {
return Text(txt)
}
struct CarouselItemView: View {
let item: CarouselItem
var body: some View {
VStack(spacing: 30) {
item.image
.resizable()
.frame(width: 120, height: 120)
item.text
.multilineTextAlignment(.center)
.font(.title2)
.foregroundColor(Color.white)
.padding([.leading,.trailing], 50.0)
}
}
}