Skip to content

Commit

Permalink
fix: 🐛 [JIRA: HCPSDKFIORIUIKIT-1940] profile header style (#744)
Browse files Browse the repository at this point in the history
Co-authored-by: Bill Zhou <bill.zhou01@sap.com>
Co-authored-by: dyongxu <61523257+dyongxu@users.noreply.github.com>
  • Loading branch information
3 people authored Jul 22, 2024
1 parent cb4a0b9 commit 585f412
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ extension ProfileHeaderFioriStyle {

func makeBody(_ configuration: TitleConfiguration) -> some View {
Title(configuration)
.foregroundStyle(Color.preferredColor(.primaryLabel))
.font(.fiori(forTextStyle: .title3, weight: .bold))
}
}
Expand All @@ -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))
}
}

Expand Down

0 comments on commit 585f412

Please sign in to comment.