From 585f412b963e3ec0b9b24bd34a5977a00e87d6c0 Mon Sep 17 00:00:00 2001 From: Xiaoyu Liu Date: Mon, 22 Jul 2024 11:20:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20[JIRA:=20HCPSDKFIORIUIKIT?= =?UTF-8?q?-1940]=20profile=20header=20style=20(#744)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bill Zhou Co-authored-by: dyongxu <61523257+dyongxu@users.noreply.github.com> --- .../ProfileHeaderStaticExample.swift | 45 ++++++++++++++----- .../ProfileHeaderStyle.fiori.swift | 4 +- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/Apps/Examples/Examples/FioriSwiftUICore/ProfileHeader/ProfileHeaderStaticExample.swift b/Apps/Examples/Examples/FioriSwiftUICore/ProfileHeader/ProfileHeaderStaticExample.swift index c68afcce2..ff3900ae1 100644 --- a/Apps/Examples/Examples/FioriSwiftUICore/ProfileHeader/ProfileHeaderStaticExample.swift +++ b/Apps/Examples/Examples/FioriSwiftUICore/ProfileHeader/ProfileHeaderStaticExample.swift @@ -2,16 +2,14 @@ import FioriSwiftUICore import SwiftUI struct ProfileHeaderStaticExample: View { - var profileHeader: some View { - ProfileHeader(detailImage: { - Image("ProfilePic").resizable() - }, title: { - Text("Title") - }, subtitle: { - Text("This is a subtitle.") - }, description: { - Text("This is a description.") - }) { + @State var useButtonForDetails = false + + @ViewBuilder var detailContent: some View { + if self.useButtonForDetails { + FioriButton { _ in + Text("Label") + } + } else { HStack(spacing: 30) { Button(action: {}, label: { Image(systemName: "mail") @@ -27,6 +25,33 @@ struct ProfileHeaderStaticExample: View { } } + var profileHeader: some View { + ProfileHeader(detailImage: { + Image("ProfilePic").resizable() + }, title: { + Text("Title") + }, subtitle: { + Text("This is a subtitle.") + }, description: { + Text("This is a description.") + }) { + self.detailContent + } + .toolbar { + ToolbarItem(placement: .topBarTrailing) { + Menu { + Button(action: { + self.useButtonForDetails.toggle() + }, label: { + Text("Icons / Button") + }) + } label: { + Text("Styles") + } + } + } + } + var body: some View { ScrollView { LazyVStack(alignment: .center, pinnedViews: [.sectionHeaders], content: { diff --git a/Sources/FioriSwiftUICore/_FioriStyles/ProfileHeaderStyle.fiori.swift b/Sources/FioriSwiftUICore/_FioriStyles/ProfileHeaderStyle.fiori.swift index 0f79eeee6..b576fa42f 100644 --- a/Sources/FioriSwiftUICore/_FioriStyles/ProfileHeaderStyle.fiori.swift +++ b/Sources/FioriSwiftUICore/_FioriStyles/ProfileHeaderStyle.fiori.swift @@ -195,6 +195,7 @@ extension ProfileHeaderFioriStyle { func makeBody(_ configuration: TitleConfiguration) -> some View { Title(configuration) + .foregroundStyle(Color.preferredColor(.primaryLabel)) .font(.fiori(forTextStyle: .title3, weight: .bold)) } } @@ -204,7 +205,8 @@ extension ProfileHeaderFioriStyle { func makeBody(_ configuration: SubtitleConfiguration) -> some View { Subtitle(configuration) - .font(.fiori(forTextStyle: .body)) + .foregroundStyle(Color.preferredColor(.secondaryLabel)) + .font(.fiori(forTextStyle: .headline)) } }