60 lines
1.8 KiB
Swift
60 lines
1.8 KiB
Swift
//
|
|
// LinkCell.swift
|
|
// Pocket Poster
|
|
//
|
|
// Created by lemin on 6/3/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct LinkCell: View {
|
|
var imageName: String
|
|
var url: String
|
|
var title: String
|
|
var contribution: String
|
|
var systemImage: Bool = false
|
|
var circle: Bool = false
|
|
|
|
var body: some View {
|
|
HStack(alignment: .center) {
|
|
Group {
|
|
if systemImage {
|
|
Image(systemName: imageName)
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
} else {
|
|
if imageName != "" {
|
|
Image(imageName)
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
}
|
|
}
|
|
}
|
|
.cornerRadius(circle ? .infinity : 0)
|
|
.frame(width: 24, height: 24)
|
|
|
|
VStack {
|
|
HStack {
|
|
Button(action: {
|
|
if url != "" {
|
|
UIApplication.shared.open(URL(string: url)!)
|
|
}
|
|
}) {
|
|
Text(title)
|
|
.fontWeight(.bold)
|
|
}
|
|
.padding(.horizontal, 6)
|
|
Spacer()
|
|
}
|
|
HStack {
|
|
Text(contribution)
|
|
.padding(.horizontal, 6)
|
|
.font(.footnote)
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|
|
.foregroundColor(.blue)
|
|
}
|
|
}
|