mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
[ADD] News, Browse and Settings views ported to SwiftUI
This commit contains WIP SwiftUI versions of most of the views in SideStore.
This commit is contained in:
46
AltStore/View Extensions/Styles/PillButtonStyle.swift
Normal file
46
AltStore/View Extensions/Styles/PillButtonStyle.swift
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// PillButtonStyle.swift
|
||||
// SideStore
|
||||
//
|
||||
// Created by Fabian Thies on 18.11.22.
|
||||
// Copyright © 2022 Fabian Thies. All rights reserved.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct PillButtonStyle: ButtonStyle {
|
||||
|
||||
let tintColor: UIColor
|
||||
var progress: Progress?
|
||||
|
||||
func makeBody(configuration: Configuration) -> some View {
|
||||
ZStack {
|
||||
if progress == nil {
|
||||
configuration.label
|
||||
.opacity(configuration.isPressed ? 0.4 : 1.0)
|
||||
} else {
|
||||
ProgressView()
|
||||
.progressViewStyle(DefaultProgressViewStyle())
|
||||
}
|
||||
}
|
||||
.frame(minWidth: 40)
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 8)
|
||||
.background(background)
|
||||
.foregroundColor(self.progress == nil ? .white : Color(tintColor))
|
||||
.clipShape(Capsule())
|
||||
}
|
||||
|
||||
var background: some View {
|
||||
ZStack {
|
||||
if let progress {
|
||||
Color(tintColor).opacity(0.15)
|
||||
|
||||
ProgressView(progress)
|
||||
.progressViewStyle(PillButtonProgressViewStyle(tint: Color(tintColor)))
|
||||
} else {
|
||||
Color(tintColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user