Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit270c7d0

Browse files
chore: make cli-auth link visually responsive (#58)
1 parent393d240 commit270c7d0

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

‎Coder Desktop/Coder Desktop/Views/LoginForm.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,7 @@ struct LoginForm<S: Session>: View {
131131
Text("Generate a session token at")
132132
.font(.subheadline)
133133
.foregroundColor(.secondary)
134-
Link(cliAuthURL.absoluteString, destination: cliAuthURL)
135-
.font(.subheadline)
136-
.foregroundColor(.blue)
134+
ResponsiveLink(title: cliAuthURL.absoluteString, destination: cliAuthURL)
137135
}
138136
}
139137
}.formStyle(.grouped).scrollDisabled(true).padding(.horizontal)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import SwiftUI
2+
3+
structResponsiveLink:View{
4+
lettitle:String
5+
letdestination:URL
6+
7+
@StateprivatevarisHovered=false
8+
@StateprivatevarisPressed=false
9+
@Environment(\.openURL)privatevaropenURL
10+
11+
varbody:someView{
12+
Text(title)
13+
.font(.subheadline)
14+
.foregroundColor(isPressed?.red:.blue)
15+
.underline(isHovered, color: isPressed?.red:.blue)
16+
.onHover{ hoveringin
17+
isHovered= hovering
18+
if hovering{
19+
NSCursor.pointingHand.push()
20+
}else{
21+
NSCursor.pop()
22+
}
23+
}
24+
.simultaneousGesture(
25+
DragGesture(minimumDistance:0)
26+
.onChanged{ _in
27+
withAnimation(.easeInOut(duration:0.1)){
28+
isPressed=true
29+
}
30+
}
31+
.onEnded{ _in
32+
withAnimation(.easeInOut(duration:0.1)){
33+
isPressed=false
34+
}
35+
openURL(destination)
36+
}
37+
)
38+
}
39+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp