Skip to content

Commit

Permalink
Add Privacy icon
Browse files Browse the repository at this point in the history
  • Loading branch information
zenangst committed May 20, 2024
1 parent 8772d73 commit dada71f
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 8 deletions.
79 changes: 79 additions & 0 deletions App/Sources/UI/Views/Icons/PrivacyIconView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import SwiftUI

struct PrivacyIconView: View {
let size: CGFloat
var body: some View {
ZStack {
InternalPrivayIconView(
size: size,
primaryColor: .systemGray,
secondaryColor: .systemGreen,
primaryTintColor: .white,
secondaryTintColor: .yellow
)

InternalPrivayIconView(
size: size,
primaryColor: .systemGreen,
secondaryColor: .white,
primaryTintColor: .systemYellow,
secondaryTintColor: .white
)
.mask(alignment: .trailing) {
Rectangle()
.frame(width: size * 0.5)
}
}
}
}

private struct InternalPrivayIconView: View {
let size: CGFloat
let primaryColor: NSColor
let secondaryColor: NSColor
let primaryTintColor: NSColor
let secondaryTintColor: NSColor

var body: some View {
Rectangle()
.fill(
LinearGradient(stops: [
.init(color: Color(primaryColor.blended(withFraction: 0.2, of: primaryTintColor)!), location: 0.0),
.init(color: Color(primaryColor.withSystemEffect(.disabled)), location: 1.0),
], startPoint: .top, endPoint: .bottom)
)
.overlay { iconOverlay().opacity(0.65) }
.overlay { iconBorder(size) }
.overlay {
LinearGradient(stops: [
.init(color: Color(nsColor: secondaryColor.blended(withFraction: 0.5, of: secondaryTintColor)!), location: 0.2),
.init(color: Color(nsColor: secondaryColor.blended(withFraction: 0.3, of: .black)!), location: 1.0),
], startPoint: .top, endPoint: .bottom)
.mask {
Image(systemName: "shield.lefthalf.filled")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: size * 0.5)
}
.shadow(radius: 4)
}
.frame(width: size, height: size)
.fixedSize()
.iconShape(size)
}
}

#Preview {
HStack(alignment: .top, spacing: 8) {
PrivacyIconView(size: 192)
VStack(alignment: .leading, spacing: 8) {
PrivacyIconView(size: 128)
HStack(alignment: .top, spacing: 8) {
PrivacyIconView(size: 64)
PrivacyIconView(size: 32)
PrivacyIconView(size: 16)
}
}
}
.padding()
}
14 changes: 6 additions & 8 deletions App/Sources/UI/Views/PromoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ private struct AutomationView: View {
var body: some View {
VStack(spacing: 16) {
TriggersIconView(size: 64)
Text("Automation")
Text("Automation\nTriggers")
.multilineTextAlignment(.center)
}
}
}
Expand Down Expand Up @@ -212,10 +213,7 @@ private struct UniqueModifierView: View {
private struct PrivacyFirstView: View {
var body: some View {
VStack(spacing: 16) {
Image(systemName: "shield.lefthalf.filled")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 64, height: 64)
PrivacyIconView(size: 64)
Text("Privacy First")
}
}
Expand Down Expand Up @@ -257,19 +255,19 @@ private struct WindowManagementView: View {
.init(color: Color(nsColor: .white.withSystemEffect(.disabled)), location: 1.0),
], startPoint: .topLeading, endPoint: .bottom)
)
.overlay { iconOverlay().opacity(0.5) }
.overlay { iconOverlay().opacity(0.25) }
.overlay(alignment: .topLeading) {
HStack(alignment: .top, spacing: 0) {
MinimizeAllWindowTrafficLightsView(size)
Rectangle()
.fill(.white)
.frame(maxWidth: .infinity)
.overlay { iconOverlay().opacity(0.5) }
.overlay { iconOverlay().opacity(0.25) }
}
}
.iconShape(size.width * 0.7)
.frame(width: size.width, height: size.height)
.shadow(color: .black.opacity(0.1), radius: 4, y: 2)
.shadow(color: .black.opacity(0.3), radius: 4, y: 2)

Text("Window Mangement")
.font(.system(size: 18, design: .rounded))
Expand Down

0 comments on commit dada71f

Please sign in to comment.