Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
TimLariviere committed Feb 1, 2023
1 parent 901b273 commit eef4630
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 26 deletions.
9 changes: 3 additions & 6 deletions samples/Gallery/Samples/Label.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@ module Label =

Border(
VStack(8.) {
Label("Custom font regular")
.font(Font.OfSize(Fonts.SourceSansProRegular, 20.))
Label("Custom font regular").font(Font.OfSize(Fonts.SourceSansProRegular, 20.))

Label("Custom font bold")
.font(Font.OfSize(Fonts.SourceSansProBold, 20.))
Label("Custom font bold").font(Font.OfSize(Fonts.SourceSansProBold, 20.))

Label("Custom font italic")
.font(Font.OfSize(Fonts.SourceSansProItalic, 20.))
Label("Custom font italic").font(Font.OfSize(Fonts.SourceSansProItalic, 20.))

Label("Custom font italic bold")
.font(Font.OfSize(Fonts.SourceSansProBoldItalic, 20.))
Expand Down
11 changes: 7 additions & 4 deletions src/Fabulous.Maui/Core/Views/Controls/Label.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ open Microsoft.Maui.Handlers.Defaults
module Label =
let WidgetKey = Widgets.register<FabLabel>()

let LineHeight = Attributes.defineMauiProperty "LineHeight" LabelDefaults.LineHeight (fun (target: IFabLabel) -> target.SetLineHeight)
let LineHeight =
Attributes.defineMauiProperty "LineHeight" LabelDefaults.LineHeight (fun (target: IFabLabel) -> target.SetLineHeight)

let TextDecorations = Attributes.defineMauiProperty "TextDecorations" LabelDefaults.TextDecorations (fun (target: IFabLabel) -> target.SetTextDecorations)
let TextDecorations =
Attributes.defineMauiProperty "TextDecorations" LabelDefaults.TextDecorations (fun (target: IFabLabel) -> target.SetTextDecorations)

[<AutoOpen>]
module LabelBuilders =
type Fabulous.Maui.View with

static member inline Label<'msg>(text: string) =
WidgetBuilder<'msg, IFabLabel>(Label.WidgetKey, Text.Text.WithValue(text))

[<Extension>]
type LabelModifiers =
[<Extension>]
static member inline textDecorations(this: WidgetBuilder<'msg, #IFabLabel>, value: TextDecorations) =
this.AddScalar(Label.TextDecorations.WithValue(value))
this.AddScalar(Label.TextDecorations.WithValue(value))
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ type TextAlignmentExtraModifiers =
[<Extension>]
static member inline centerTextVertical(this: WidgetBuilder<'msg, #IFabTextAlignment>) =
this.verticalTextAlignment(TextAlignment.Center)

[<Extension>]
static member inline alignTextStartHorizontal(this: WidgetBuilder<'msg, #IFabTextAlignment>) =
this.horizontalTextAlignment(TextAlignment.Start)

[<Extension>]
static member inline alignTextStartVertical(this: WidgetBuilder<'msg, #IFabTextAlignment>) =
this.verticalTextAlignment(TextAlignment.Start)

[<Extension>]
static member inline alignTextEndHorizontal(this: WidgetBuilder<'msg, #IFabTextAlignment>) =
this.horizontalTextAlignment(TextAlignment.End)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ open Fabulous
module TextStyle =
let CharacterSpacing =
Attributes.defineMauiProperty "CharacterSpacing" TextStyleDefaults.CharacterSpacing (fun (target: IFabTextStyle) -> target.SetCharacterSpacing)

let Font =
Attributes.defineMauiProperty' "Font" TextStyleDefaults.CreateDefaultFont (fun (target: IFabTextStyle) -> target.SetFont)

Expand Down
10 changes: 3 additions & 7 deletions src/Fabulous.Maui/Core/Views/Layouts/Border.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ open Microsoft.Maui

module Border =
let WidgetKey = Widgets.register<FabBorderView>()

[<AutoOpen>]
module BorderBuilders =
type Fabulous.Maui.View with

static member inline Border(content: WidgetBuilder<'msg, #IView>) =
WidgetBuilder<'msg, IFabBorderView>(
Border.WidgetKey,
AttributesBundle(
StackList.empty(),
ValueSome [| ContentView.PresentedContent.WithValue(content.Compile()) |],
ValueNone
)
AttributesBundle(StackList.empty(), ValueSome [| ContentView.PresentedContent.WithValue(content.Compile()) |], ValueNone)
)

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ open Microsoft.Maui.Handlers.Defaults
module BorderStroke =
let Shape =
Attributes.defineMauiProperty "Shape" BorderStrokeDefaults.Shape (fun (target: IFabBorderStroke) -> target.SetShape)

10 changes: 5 additions & 5 deletions src/Fabulous.Maui/Core/Views/Layouts/Partials/_Stroke.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ module Stroke =

let StrokeLineCap =
Attributes.defineMauiProperty "StrokeLineCap" StrokeDefaults.StrokeLineCap (fun (target: IFabStroke) -> target.SetStrokeLineCap)

let StrokeLineJoin =
Attributes.defineMauiProperty "StrokeLineJoin" StrokeDefaults.StrokeLineJoin (fun (target: IFabStroke) -> target.SetStrokeLineJoin)

let StrokeDashPattern =
Attributes.defineMauiProperty "StrokeDashPattern" StrokeDefaults.StrokeDashPattern (fun (target: IFabStroke) -> target.SetStrokeDashPattern)

let StrokeDashOffset =
Attributes.defineMauiProperty "StrokeDashOffset" StrokeDefaults.StrokeDashOffset (fun (target: IFabStroke) -> target.SetStrokeDashOffset)

let StrokeMiterLimit =
Attributes.defineMauiProperty "StrokeMiterLimit" StrokeDefaults.StrokeMiterLimit (fun (target: IFabStroke) -> target.SetStrokeMiterLimit)
Attributes.defineMauiProperty "StrokeMiterLimit" StrokeDefaults.StrokeMiterLimit (fun (target: IFabStroke) -> target.SetStrokeMiterLimit)

0 comments on commit eef4630

Please sign in to comment.