mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-28 15:44:32 +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
|
// Close button positioned in top-left corner
|
||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
Button(action: onClose) {
|
NativeStyleCloseButton(action: onClose)
|
||||||
Image(systemName: "xmark")
|
.padding(.leading, 8)
|
||||||
.font(.system(size: 12, weight: .medium))
|
.padding(.top, 8)
|
||||||
.foregroundColor(.white)
|
|
||||||
.frame(width: 24, height: 24)
|
|
||||||
.background(Color.red)
|
|
||||||
.clipShape(Circle())
|
|
||||||
}
|
|
||||||
.buttonStyle(PlainButtonStyle())
|
|
||||||
.padding(.leading, 12)
|
|
||||||
.padding(.top, 12)
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -194,17 +194,9 @@ struct ColorPickerPanelView: View {
|
||||||
// Close button positioned in top-left corner
|
// Close button positioned in top-left corner
|
||||||
VStack {
|
VStack {
|
||||||
HStack {
|
HStack {
|
||||||
Button(action: onClose) {
|
NativeStyleCloseButton(action: onClose)
|
||||||
Image(systemName: "xmark")
|
.padding(.leading, 8)
|
||||||
.font(.system(size: 12, weight: .medium))
|
.padding(.top, 8)
|
||||||
.foregroundColor(.white)
|
|
||||||
.frame(width: 24, height: 24)
|
|
||||||
.background(Color.red)
|
|
||||||
.clipShape(Circle())
|
|
||||||
}
|
|
||||||
.buttonStyle(PlainButtonStyle())
|
|
||||||
.padding(.leading, 12)
|
|
||||||
.padding(.top, 12)
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
|
|
@ -668,6 +660,30 @@ struct ColorPickerVisualEffectView: NSViewRepresentable {
|
||||||
func updateNSView(_ nsView: NSVisualEffectView, context: Context) {}
|
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 {
|
#Preview {
|
||||||
ColorPickerPanelView {
|
ColorPickerPanelView {
|
||||||
print("Close panel")
|
print("Close panel")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue