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 SwiftUI
protocol TextStyle: ViewModifier {}
protocol TextStyles: ViewModifier {}
extension Text {
func textStyle(T: any TextStyle) {
modifier(T)
func textStyle<T: TextStyles>(_ style: T) -> some View {
modifier(style)
}
}
struct TextStyles {
static let ViewTitle = ViewTitleTextStyle()
struct CustomTextStyles {
static let Title = ViewTitleTextStyle()
}

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

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

Loading…
Cancel
Save