Tweak link icons
This commit is contained in:
parent
19848ba8e4
commit
8a895b70c8
|
@ -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()
|
||||||
|
|
|
@ -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,19 +54,26 @@ 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 {
|
} else {
|
||||||
imageName = "link"
|
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 {
|
let button: some View = Button {
|
||||||
self.changeURL?(url)
|
self.changeURL?(url)
|
||||||
} 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)
|
||||||
|
|
Loading…
Reference in New Issue