diff --git a/Coder Desktop/Coder Desktop/Views/LoginForm.swift b/Coder Desktop/Coder Desktop/Views/LoginForm.swift index 8943b506..d501437f 100644 --- a/Coder Desktop/Coder Desktop/Views/LoginForm.swift +++ b/Coder Desktop/Coder Desktop/Views/LoginForm.swift @@ -128,9 +128,7 @@ struct LoginForm: View { Text("Generate a session token at ") .font(.subheadline) .foregroundColor(.secondary) - Link(cliAuthURL.absoluteString, destination: cliAuthURL) - .font(.subheadline) - .foregroundColor(.blue) + ResponsiveLink(title: cliAuthURL.absoluteString, destination: cliAuthURL) } } }.formStyle(.grouped).scrollDisabled(true).padding(.horizontal) diff --git a/Coder Desktop/Coder Desktop/Views/ResponsiveLink.swift b/Coder Desktop/Coder Desktop/Views/ResponsiveLink.swift new file mode 100644 index 00000000..fd37881a --- /dev/null +++ b/Coder Desktop/Coder Desktop/Views/ResponsiveLink.swift @@ -0,0 +1,39 @@ +import SwiftUI + +struct ResponsiveLink: View { + let title: String + let destination: URL + + @State private var isHovered = false + @State private var isPressed = false + @Environment(\.openURL) private var openURL + + var body: some View { + Text(title) + .font(.subheadline) + .foregroundColor(isPressed ? .red : .blue) + .underline(isHovered, color: isPressed ? .red : .blue) + .onHover { hovering in + isHovered = hovering + if hovering { + NSCursor.pointingHand.push() + } else { + NSCursor.pop() + } + } + .simultaneousGesture( + DragGesture(minimumDistance: 0) + .onChanged { _ in + withAnimation(.easeInOut(duration: 0.1)) { + isPressed = true + } + } + .onEnded { _ in + withAnimation(.easeInOut(duration: 0.1)) { + isPressed = false + } + openURL(destination) + } + ) + } +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy