Add vibrant button style

This commit is contained in:
Maurice Parker
2019-09-16 10:57:27 -05:00
parent 00310b7bd7
commit 7bda205af8
3 changed files with 60 additions and 30 deletions

View File

@@ -0,0 +1,23 @@
//
// VibrantButtonStyle.swift
// NetNewsWire-iOS
//
// Created by Maurice Parker on 9/16/19.
// Copyright © 2019 Ranchero Software. All rights reserved.
//
import SwiftUI
struct VibrantButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
GeometryReader { geometry in
configuration.label
.frame(width: geometry.size.width, height: geometry.size.height, alignment: .leading)
}
.foregroundColor(configuration.isPressed ? Color(AppAssets.tableViewCellHighlightedTextColor) : .primary)
.listRowBackground(configuration.isPressed ? Color(AppAssets.tableViewCellSelectionColor) : Color(.secondarySystemGroupedBackground))
.background(configuration.isPressed ? Color(AppAssets.tableViewCellSelectionColor) : Color(.secondarySystemGroupedBackground))
}
}