damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 561e2cd3adc28e435ed71957aac6c0d82046b178
parent ad87a624864859d55770bb37c70c038aa4e5a300
Author: William Casarin <jb55@jb55.com>
Date:   Wed, 25 Jan 2023 08:24:14 -0800

refactor: add profile_button_style view extension

Diffstat:
Mdamus/Views/ProfileView.swift | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/damus/Views/ProfileView.swift b/damus/Views/ProfileView.swift @@ -147,9 +147,7 @@ struct ProfileView: View { } }) { Image(systemName: "bolt.circle") - .symbolRenderingMode(.palette) - .foregroundStyle(colorScheme == .dark ? .white : .black, colorScheme == .dark ? .white : .black) - .font(.system(size: 32).weight(.thin)) + .profile_button_style(scheme: colorScheme) .contextMenu { Button { UIPasteboard.general.string = profile.lnurl ?? "" @@ -172,11 +170,8 @@ struct ProfileView: View { Button(action: { show_share_sheet = true }) { - Image(systemName: "square.and.arrow.up.circle.fill") - .symbolRenderingMode(.palette) - .font(.system(size: 32)) - .padding() - .foregroundStyle(.white, .black, .black.opacity(0.8)) + Image(systemName: "square.and.arrow.up.circle") + .profile_button_style(scheme: colorScheme) } } @@ -186,9 +181,7 @@ struct ProfileView: View { .environmentObject(dm_model) return NavigationLink(destination: dmview) { Image(systemName: "bubble.left.circle") - .symbolRenderingMode(.palette) - .font(.system(size: 32).weight(.thin)) - .foregroundStyle(colorScheme == .dark ? .white : .black, colorScheme == .dark ? .white : .black) + .profile_button_style(scheme: colorScheme) } } @@ -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) + } +}