44 lines
1.2 KiB
Swift
44 lines
1.2 KiB
Swift
//
|
|
// NavBar.swift
|
|
// IgniteSamples
|
|
// https://www.github.com/twostraws/Ignite
|
|
// See LICENSE for license information.
|
|
//
|
|
|
|
import Foundation
|
|
import Ignite
|
|
|
|
/// Displays a global "Social Footer", with each social icon linking to an
|
|
/// external site in a new browser tab, demonstrating how to create reusable
|
|
/// components with builtIn icons, external links and custom attributes.
|
|
struct SocialFooter: HTML {
|
|
let icons = [
|
|
Image(systemName: "github"),
|
|
Image(systemName: "twitter"),
|
|
Image(systemName: "youtube"),
|
|
Image(systemName: "mastodon")
|
|
]
|
|
|
|
let urlStrings = [
|
|
"https://github.com/twostraws",
|
|
"https://twitter.com/twostraws",
|
|
"https://youtube.com/@twostraws",
|
|
"https://mastodon.social/@twostraws"
|
|
]
|
|
|
|
var body: some HTML {
|
|
VStack {
|
|
HStack {
|
|
ForEach(zip(icons, urlStrings)) { (icon, urlString) in
|
|
Link(icon, target: urlString)
|
|
.role(.secondary)
|
|
.target(.blank)
|
|
.relationship(.noOpener, .noReferrer)
|
|
}
|
|
}
|
|
}
|
|
.margin(.top, .xLarge)
|
|
.font(.title2)
|
|
}
|
|
}
|