Tweak link icons

This commit is contained in:
Shadowfacts 2020-09-29 16:28:37 -04:00
parent 19848ba8e4
commit 8a895b70c8
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 14 additions and 6 deletions

View File

@ -39,6 +39,7 @@ public struct BrowserView: View {
Text("An error occurred")
.font(.headline)
Text(message)
.lineLimit(nil)
case let .document(doc):
DocumentView(document: doc, scrollingEnabled: scrollingEnabled, changeURL: navigator.changeURL)
Spacer()

View File

@ -39,7 +39,7 @@ struct RenderingBlockView: View {
}
private func text(_ text: String) -> some View {
Text(text)
Text(verbatim: text)
.font(.documentBody)
.frame(maxWidth: .infinity, alignment: .leading)
}
@ -54,12 +54,18 @@ struct RenderingBlockView: View {
#endif
let imageName: String
if url.scheme != "gemini" {
imageName = "arrow.up.left.square"
} else if url.host == document.url.host {
imageName = "arrow.right"
if url.scheme == "gemini" {
if url.host == document.url.host {
imageName = "arrow.right"
} else {
imageName = "link"
}
} else if url.scheme == "http" || url.scheme == "https" {
imageName = "safari"
} else if url.scheme == "mailto" {
imageName = "envelope"
} else {
imageName = "link"
imageName = "arrow.up.left.square"
}
let button: some View = Button {
@ -67,6 +73,7 @@ struct RenderingBlockView: View {
} label: {
HStack(alignment: .firstTextBaseline, spacing: 4) {
Image(systemName: imageName)
.frame(minWidth: 23, alignment: .leading)
Text(verbatim: text)
.font(.documentBody)