Files
Cable/Cable/Loads/LoadEditorView.swift
Stefan Lange-Hegermann 6258a6a66f more consitancy
2025-10-22 22:43:03 +02:00

46 lines
1.7 KiB
Swift

//
// LoadEditorView.swift
// Cable
//
// Created by Stefan Lange-Hegermann on 11.09.25.
//
import SwiftUI
struct LoadEditorView: View {
@Binding var loadName: String
@Binding var iconName: String
@Binding var colorName: String
@Binding var remoteIconURLString: String?
private let loadIcons = [
"lightbulb", "lamp.desk", "fan", "tv", "poweroutlet.strip","poweroutlet.type.c", "bolt", "xbox.logo", "playstation.logo", "batteryblock", "speaker.wave.2", "refrigerator",
"washer", "dishwasher", "stove", "microwave", "dryer", "cooktop",
"car", "bolt.car", "engine.combustion", "wrench.adjustable",
"cpu", "desktopcomputer", "laptopcomputer", "iphone", "camera",
"gamecontroller", "headphones", "printer", "wifi", "antenna.radiowaves.left.and.right"
]
var body: some View {
ItemEditorView(
title: String(localized: "editor.load.title", comment: "Title for the load editor"),
nameFieldLabel: String(localized: "editor.load.name_field", comment: "Label for the load name text field"),
previewSubtitle: String(localized: "editor.load.preview", comment: "Placeholder subtitle in the load editor preview"),
icons: loadIcons,
name: $loadName,
iconName: $iconName,
colorName: $colorName,
remoteIconURLString: $remoteIconURLString
)
}
}
#Preview {
@Previewable @State var name = "My Load"
@Previewable @State var icon = "lightbulb"
@Previewable @State var color = "blue"
@Previewable @State var remoteIcon: String? = "https://example.com/icon.png"
return LoadEditorView(loadName: $name, iconName: $icon, colorName: $color, remoteIconURLString: $remoteIcon)
}