Skip to content

Commit

Permalink
Add new operations on Panel and PanelHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
galassie committed Feb 3, 2023
1 parent f73036d commit 04ee8b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/FsSpectre/FsSpectre.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- NuGet config -->
<PackageId>FsSpectre</PackageId>
<Version>0.3.5</Version>
<Version>0.3.6</Version>
<Authors>Enrico Galassi</Authors>
<PackageTags>fsharp;cli;dotnet;console-application;fsharp-console;</PackageTags>
<PackageProjectUrl>https://github.com/galassie/fs-spectre</PackageProjectUrl>
Expand Down
5 changes: 5 additions & 0 deletions src/FsSpectre/Widgets/PanelBuilder.fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ module PanelBuilder =
panel.Header <- PanelHeader(text)
panel

[<CustomOperation "Expand">]
member __.Expand(panel: Panel) =
panel.Expand <- true
panel

[<CustomOperation "width">]
member __.Width(panel: Panel, width: int) =
panel.Width <- width
Expand Down
12 changes: 8 additions & 4 deletions src/FsSpectre/Widgets/PanelHeaderBuilder.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ module PanelHeaderBuilder =
[<CustomOperation "text">]
member __.Text(_, text: string) = PanelHeader(text)

[<CustomOperation "justification">]
member __.Justification(panelHeader: PanelHeader, justify: Justify) =
panelHeader.Justification <- justify
panelHeader
[<CustomOperation "left_justified">]
member __.LeftJustified(panelHeader: PanelHeader) = panelHeader.LeftJustified()

[<CustomOperation "right_justified">]
member __.RightJustified(panelHeader: PanelHeader) = panelHeader.RightJustified()

[<CustomOperation "centered">]
member __.Centered(panelHeader: PanelHeader) = panelHeader.Centered()

let panelHeader = PanelHeaderBuilder()

0 comments on commit 04ee8b2

Please sign in to comment.