mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Restored files from old Mac, force pushing
This commit is contained in:
parent
5dd95228b8
commit
5040381840
126 changed files with 10431 additions and 67 deletions
46
DynamicIsland/components/HoverButton.swift
Normal file
46
DynamicIsland/components/HoverButton.swift
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// HoverButton.swift
|
||||
// boringNotch
|
||||
//
|
||||
// Created by Kraigo on 04.09.2024.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct HoverButton: View {
|
||||
var icon: String
|
||||
var iconColor: Color = .white;
|
||||
var scale: Image.Scale = .medium
|
||||
var action: () -> Void
|
||||
var contentTransition: ContentTransition = .symbolEffect;
|
||||
|
||||
@State private var isHovering = false
|
||||
|
||||
var body: some View {
|
||||
let size = CGFloat(scale == .large ? 40 : 30)
|
||||
|
||||
Button(action: action) {
|
||||
Rectangle()
|
||||
.fill(.clear)
|
||||
.contentShape(Rectangle())
|
||||
.frame(width: size, height: size)
|
||||
.overlay {
|
||||
Capsule()
|
||||
.fill(isHovering ? Color.gray.opacity(0.2) : .clear)
|
||||
.frame(width: size, height: size)
|
||||
.overlay {
|
||||
Image(systemName: icon)
|
||||
.foregroundColor(iconColor)
|
||||
.contentTransition(contentTransition)
|
||||
.font(scale == .large ? .largeTitle : .body)
|
||||
}
|
||||
}
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
.onHover { hovering in
|
||||
withAnimation(.smooth(duration: 0.3)) {
|
||||
isHovering = hovering
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue