piper-app/Piper/Sources/UI/Components/ListItemEmpty.swift
Javier Cicchelli 3d78c599d1 [App] Repositories in the Menu Bar view (#4)
This PR contains the work done to implement the rendering of the (lack of) repositories in the `MenuBarView` view UI interface. For this purpose, some components have been created: `ListHeader`, `ListItemEmpty`, and `ListItem`. Furthermore, some preview-specific code have been implemented as well, specially to add dummy repositories to the previews.

Reviewed-on: #4
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
2024-10-06 11:50:36 +00:00

62 lines
1.6 KiB
Swift

//
// ListItemEmpty.swift
// Piper ~ App
//
// Created by Javier Cicchelli on 06/10/2024.
// Copyright © 2024 Röck+Cöde. All rights reserved.
//
import SwiftUI
struct ListItemEmpty: View {
// MARK: Properties
let title: LocalizedStringKey
let button: LocalizedStringKey
let onAction: () -> Void
// MARK: Body
var body: some View {
GeometryReader { proxy in
Color.clear
.overlay {
VStack(spacing: 16) {
Text(title)
.font(.title)
.foregroundStyle(.secondary)
.frame(maxWidth: .infinity)
.multilineTextAlignment(.center)
Button(action: onAction) {
Text(button)
.font(.body)
.fontWeight(.semibold)
.multilineTextAlignment(.center)
}
.buttonStyle(.link)
.foregroundStyle(.primary)
}
}
.padding(.horizontal, proxy.size.width * 0.2)
}
}
}
// MARK: - Previews
#Preview("List Item Empty component with title and button") {
List {
ListItemEmpty(
title: "Some title text goes here...",
button: "Some button text goes here..."
) {
// ...
}
.frame(height: 300)
}
.frame(width: 400, height: 300)
}