NetNewsWire/iOS/SwiftUI Extensions/VibrantButtonStyle.swift
2019-09-16 11:35:09 -05:00

26 lines
849 B
Swift

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