Browse Source

refactor: add profile_button_style view extension

zaps
William Casarin 2 years ago
parent
commit
561e2cd3ad
  1. 23
      damus/Views/ProfileView.swift

23
damus/Views/ProfileView.swift

@ -147,9 +147,7 @@ struct ProfileView: View {
} }
}) { }) {
Image(systemName: "bolt.circle") Image(systemName: "bolt.circle")
.symbolRenderingMode(.palette) .profile_button_style(scheme: colorScheme)
.foregroundStyle(colorScheme == .dark ? .white : .black, colorScheme == .dark ? .white : .black)
.font(.system(size: 32).weight(.thin))
.contextMenu { .contextMenu {
Button { Button {
UIPasteboard.general.string = profile.lnurl ?? "" UIPasteboard.general.string = profile.lnurl ?? ""
@ -172,11 +170,8 @@ struct ProfileView: View {
Button(action: { Button(action: {
show_share_sheet = true show_share_sheet = true
}) { }) {
Image(systemName: "square.and.arrow.up.circle.fill") Image(systemName: "square.and.arrow.up.circle")
.symbolRenderingMode(.palette) .profile_button_style(scheme: colorScheme)
.font(.system(size: 32))
.padding()
.foregroundStyle(.white, .black, .black.opacity(0.8))
} }
} }
@ -186,9 +181,7 @@ struct ProfileView: View {
.environmentObject(dm_model) .environmentObject(dm_model)
return NavigationLink(destination: dmview) { return NavigationLink(destination: dmview) {
Image(systemName: "bubble.left.circle") Image(systemName: "bubble.left.circle")
.symbolRenderingMode(.palette) .profile_button_style(scheme: colorScheme)
.font(.system(size: 32).weight(.thin))
.foregroundStyle(colorScheme == .dark ? .white : .black, colorScheme == .dark ? .white : .black)
} }
} }
@ -473,3 +466,11 @@ struct KeyView: View {
} }
} }
} }
extension View {
func profile_button_style(scheme: ColorScheme) -> some View {
self.symbolRenderingMode(.palette)
.font(.system(size: 32).weight(.thin))
.foregroundStyle(scheme == .dark ? .white : .black, scheme == .dark ? .white : .black)
}
}

Loading…
Cancel
Save