Merge branch 'dev_views_ViewTitle' into dev_views

pull/9/head
Rémi REGNAULT 11 months ago
commit 6988a8f429

@ -8,14 +8,14 @@
import Foundation import Foundation
import SwiftUI import SwiftUI
protocol TextStyle: ViewModifier {} protocol TextStyles: ViewModifier {}
extension Text { extension Text {
func textStyle(T: any TextStyle) { func textStyle<T: TextStyles>(_ style: T) -> some View {
modifier(T) modifier(style)
} }
} }
struct TextStyles { struct CustomTextStyles {
static let ViewTitle = ViewTitleTextStyle() static let Title = ViewTitleTextStyle()
} }

@ -8,7 +8,7 @@
import Foundation import Foundation
import SwiftUI import SwiftUI
struct ViewTitleTextStyle: TextStyle { struct ViewTitleTextStyle: TextStyles {
func body(content: Content) -> some View { func body(content: Content) -> some View {
content content
.foregroundColor(Colors.TitleText) .foregroundColor(Colors.TitleText)

@ -13,8 +13,8 @@ struct TitlePageFrame: View {
var Text: String var Text: String
// Image Params // Image Params
var ImageWidth: CGFloat var ImageWidth: CGFloat = 200
var ImageHeight: CGFloat var ImageHeight: CGFloat = 200
var body: some View { var body: some View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
@ -25,9 +25,7 @@ struct TitlePageFrame: View {
.frame(width: ImageWidth, height: ImageHeight) .frame(width: ImageWidth, height: ImageHeight)
SwiftUI.Text(self.Text) SwiftUI.Text(self.Text)
.foregroundColor(Colors.TitleText) .textStyle(CustomTextStyles.Title)
.fontWeight(.bold)
.font(.custom(Fonts.title, size: 30))
} }
} }
@ -36,6 +34,6 @@ struct TitlePageFrame: View {
struct TitlePageFrame_Previews: PreviewProvider { struct TitlePageFrame_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
TitlePageFrame(Text: "DouShouQi", ImageWidth: 200, ImageHeight: 200) TitlePageFrame(Text: "DouShouQi")
} }
} }

Loading…
Cancel
Save