mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Working
This commit is contained in:
parent
f84c0aafa4
commit
f06e14074a
2 changed files with 30 additions and 22 deletions
|
|
@ -200,17 +200,9 @@ struct ClipboardPanelView: View {
|
|||
// Close button positioned in top-left corner
|
||||
VStack {
|
||||
HStack {
|
||||
Button(action: onClose) {
|
||||
Image(systemName: "xmark")
|
||||
.font(.system(size: 12, weight: .medium))
|
||||
.foregroundColor(.white)
|
||||
.frame(width: 24, height: 24)
|
||||
.background(Color.red)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
.padding(.leading, 12)
|
||||
.padding(.top, 12)
|
||||
NativeStyleCloseButton(action: onClose)
|
||||
.padding(.leading, 8)
|
||||
.padding(.top, 8)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,17 +194,9 @@ struct ColorPickerPanelView: View {
|
|||
// Close button positioned in top-left corner
|
||||
VStack {
|
||||
HStack {
|
||||
Button(action: onClose) {
|
||||
Image(systemName: "xmark")
|
||||
.font(.system(size: 12, weight: .medium))
|
||||
.foregroundColor(.white)
|
||||
.frame(width: 24, height: 24)
|
||||
.background(Color.red)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
.padding(.leading, 12)
|
||||
.padding(.top, 12)
|
||||
NativeStyleCloseButton(action: onClose)
|
||||
.padding(.leading, 8)
|
||||
.padding(.top, 8)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
|
|
@ -668,6 +660,30 @@ struct ColorPickerVisualEffectView: NSViewRepresentable {
|
|||
func updateNSView(_ nsView: NSVisualEffectView, context: Context) {}
|
||||
}
|
||||
|
||||
// MARK: - Native Style Close Button Component
|
||||
struct NativeStyleCloseButton: View {
|
||||
let action: () -> Void
|
||||
@State private var isHovered = false
|
||||
|
||||
var body: some View {
|
||||
Button(action: action) {
|
||||
Image(systemName: "xmark")
|
||||
.font(.system(size: 8, weight: .medium))
|
||||
.foregroundColor(.white)
|
||||
.frame(width: 13, height: 13)
|
||||
.background(isHovered ? Color.red.opacity(0.8) : Color.red)
|
||||
.clipShape(Circle())
|
||||
.scaleEffect(isHovered ? 1.1 : 1.0)
|
||||
}
|
||||
.buttonStyle(PlainButtonStyle())
|
||||
.onHover { hovering in
|
||||
withAnimation(.easeInOut(duration: 0.1)) {
|
||||
isHovered = hovering
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ColorPickerPanelView {
|
||||
print("Close panel")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue