mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Move Compound Inspector into the project.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// Copyright 2025 New Vector Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Compound
|
||||
|
||||
struct GradientsScreen: View {
|
||||
var body: some View {
|
||||
ScreenContent(navigationTitle: "Colors") {
|
||||
ForEach(Gradient.compound.allValues, id: \.name) { gradient in
|
||||
GradientItem(gradient: gradient.value, name: gradient.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct GradientItem: View {
|
||||
let gradient: Gradient
|
||||
let name: String
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
swatch
|
||||
|
||||
VStack(alignment: .leading) {
|
||||
Text(name)
|
||||
.font(.compound.bodyLG)
|
||||
.foregroundColor(.compound.textPrimary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var swatch: some View {
|
||||
swatchShape
|
||||
.foregroundStyle(gradient)
|
||||
.frame(height: 40)
|
||||
.aspectRatio(1, contentMode: .fit)
|
||||
.overlay {
|
||||
swatchShape
|
||||
.strokeBorder(Color.compound.iconPrimary, lineWidth: 1.5)
|
||||
.opacity(0.2)
|
||||
}
|
||||
}
|
||||
|
||||
var swatchShape: some InsettableShape {
|
||||
RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
}
|
||||
}
|
||||
|
||||
struct GradientsScreen_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
NavigationStack {
|
||||
ColorsScreen()
|
||||
}
|
||||
.previewLayout(.fixed(width: 375, height: 700))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user