Tweak link icons
This commit is contained in:
parent
19848ba8e4
commit
8a895b70c8
|
@ -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()
|
||||
|
|
|
@ -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,19 +54,26 @@ struct RenderingBlockView: View {
|
|||
#endif
|
||||
|
||||
let imageName: String
|
||||
if url.scheme != "gemini" {
|
||||
imageName = "arrow.up.left.square"
|
||||
} else if url.host == document.url.host {
|
||||
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 = "arrow.up.left.square"
|
||||
}
|
||||
|
||||
let button: some View = Button {
|
||||
self.changeURL?(url)
|
||||
} label: {
|
||||
HStack(alignment: .firstTextBaseline, spacing: 4) {
|
||||
Image(systemName: imageName)
|
||||
.frame(minWidth: 23, alignment: .leading)
|
||||
|
||||
Text(verbatim: text)
|
||||
.font(.documentBody)
|
||||
|
|
Loading…
Reference in New Issue