Better copy overlay

This commit is contained in:
Max Goedjen 2020-03-06 19:07:38 -08:00
parent 609c1c1bbb
commit bf38890d09
No known key found for this signature in database
GPG Key ID: E58C21DD77B9B8E8
1 changed files with 12 additions and 9 deletions

View File

@ -21,19 +21,22 @@ struct SecretDetailView<SecretType: Secret>: View {
} }
Spacer().frame(height: 10) Spacer().frame(height: 10)
GroupBox(label: Text("Public Key")) { GroupBox(label: Text("Public Key")) {
Text(keyWriter.openSSHString(secret: secret)) VStack {
.multilineTextAlignment(.leading) Text(keyWriter.openSSHString(secret: secret))
.frame(minWidth: 150, maxWidth: .infinity) .multilineTextAlignment(.leading)
.padding() .frame(minWidth: 150, maxWidth: .infinity)
HStack {
Spacer()
Button(action: copy) {
Text("Copy")
}
}
}
.padding()
} }
.onDrag { .onDrag {
return NSItemProvider(item: NSData(data: self.keyString.data(using: .utf8)!), typeIdentifier: kUTTypeUTF8PlainText as String) return NSItemProvider(item: NSData(data: self.keyString.data(using: .utf8)!), typeIdentifier: kUTTypeUTF8PlainText as String)
} }
.overlay(
Button(action: copy) {
Text("Copy")
}.padding(),
alignment: .bottomTrailing)
Spacer() Spacer()
} }
}.padding() }.padding()