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") Text("An error occurred")
.font(.headline) .font(.headline)
Text(message) Text(message)
.lineLimit(nil)
case let .document(doc): case let .document(doc):
DocumentView(document: doc, scrollingEnabled: scrollingEnabled, changeURL: navigator.changeURL) DocumentView(document: doc, scrollingEnabled: scrollingEnabled, changeURL: navigator.changeURL)
Spacer() Spacer()

View File

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