-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
127 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
|
||
|
||
#if WATCH | ||
let urlPrefix = | ||
"" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace FsLab.Fornax.Components | ||
|
||
open Html | ||
|
||
type Navbar() = | ||
|
||
static member navbar [] [] = () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
namespace FsLab.Fornax.Components | ||
|
||
open Html | ||
open FsLab.Fornax.Helpers | ||
|
||
|
||
type RootOption = | ||
| Title of string | ||
| PrefixUrl of (string -> string) | ||
| AdditionalHeadTags of HtmlElement list | ||
|
||
type internal RootConfig = { | ||
mutable Title : string | ||
mutable PrefixUrl: string -> string | ||
mutable AdditionalHeadTags: HtmlElement list | ||
} with | ||
static member defaultConfig() = | ||
{ | ||
Title = "" | ||
PrefixUrl = id | ||
AdditionalHeadTags = [] | ||
} | ||
static member ofOptions (opts: RootOption list) = | ||
|
||
let config = RootConfig.defaultConfig() | ||
|
||
opts | ||
|> List.iter (fun opt -> | ||
match opt with | ||
| Title t -> config.Title <- t | ||
| PrefixUrl f -> config.PrefixUrl <- f | ||
| AdditionalHeadTags t -> config.AdditionalHeadTags <- t | ||
) | ||
|
||
config | ||
|
||
type Root() = | ||
|
||
static member root (rootOptions: RootOption list) (children: HtmlElement list) = | ||
|
||
let config = RootConfig.ofOptions rootOptions | ||
|
||
html [Class "has-navbar-fixed-top"] [ | ||
head [] [ | ||
meta [CharSet "utf-8"] | ||
meta [Name "viewport"; Content "width=device-width, initial-scale=1"] | ||
title [] [!! config.Title] | ||
link [Rel "icon"; Type "image/png"; Sizes "32x32"; Href "/images/favicon.png"] | ||
link [Rel "stylesheet"; Href "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"] | ||
link [Rel "stylesheet"; Href "https://fonts.googleapis.com/css?family=Nunito+Sans"] | ||
link [Rel "stylesheet"; Href "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.1/css/bulma.min.css"] | ||
link [Rel "stylesheet"; Href "https://cdn.jsdelivr.net/npm/bulma-carousel@4.0.4/dist/css/bulma-carousel.min.css"] | ||
link [Rel "stylesheet"; Type "text/css"; Href (config.PrefixUrl "/style/style.css")] | ||
link [Rel "stylesheet"; Type "text/css"; Href "https://cdn.jsdelivr.net/npm/@creativebulma/bulma-collapsible@1.0.4/dist/css/bulma-collapsible.min.css"] | ||
|
||
script [ Defer true; Src "https://kit.fontawesome.com/0d3e0ea7a6.js"; CrossOrigin "anonymous"] [] | ||
|
||
script [ Defer true; Type "text/javascript"; Src "https://cdn.jsdelivr.net/npm/@creativebulma/bulma-collapsible@1.0.4/dist/js/bulma-collapsible.min.js"] [] | ||
script [ Defer true; Type "text/javascript"; Src ("https://cdn.jsdelivr.net/npm/bulma-carousel@4.0.4/dist/js/bulma-carousel.min.js") ] [] | ||
|
||
script [ Defer true; Type "text/javascript"; Src (config.PrefixUrl "/js/prism.js") ] [] | ||
script [ Defer true; Type "text/javascript"; Src (config.PrefixUrl "/js/slider.js") ] [] | ||
script [ Defer true; Type "text/javascript"; Src (config.PrefixUrl "/js/navbar.js") ] [] | ||
|
||
yield! config.AdditionalHeadTags | ||
] | ||
body [] [] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Library.fs" /> | ||
<Compile Include="Components\Root.fs" /> | ||
<Compile Include="Components/Navbar.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="Fornax"> | ||
<HintPath>_lib\Fornax.Core.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="_lib\Fornax.Core.dll"> | ||
<Pack>true</Pack> | ||
<PackagePath>lib\$(TargetFramework)</PackagePath> | ||
</Content> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Update="FSharp.Core" Version="5.*" /> | ||
<PackageReference Include="Markdig" Version="0.30.2" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
namespace FsLab.Fornax | ||
|
||
module Say = | ||
let hello name = | ||
printfn "Hello %s" name | ||
[<AutoOpen>] | ||
module internal Helpers = | ||
|
||
[<AutoOpen>] | ||
module List = | ||
|
||
let tryFindDefault (predicate: 'T -> bool) (defaultValue: 'T) (list: 'T List) = | ||
list | ||
|> List.tryFind predicate | ||
|> Option.defaultValue defaultValue |
Binary file not shown.