Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

Commit

Permalink
Add components to library ✨
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Jun 14, 2022
1 parent 5a62562 commit 682f790
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 61 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,5 @@ MigrationBackup/
.ionide/
client/_public
.vscode/settings.json
.vscode/
.vscode/
pkg/
13 changes: 11 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
### 0.0.0+9132222 (Released 2022-6-13)
### 0.1.0+5a62562 (Released 2022-6-14)
* Additions:
* latest commit #9132222
* latest commit #5a62562
* [[#5a62562](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/5a62562d7913119af92cf325a4b6abba47defbb7)] Move fornax test client to different folder :hammer:
* [[#e03fb21](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/e03fb21df30872acfc242b0458f7c0e9eba2320b)] update gitignore
* [[#675aa1a](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/675aa1aa20a8c26dbde9995442e70beaf336cdb7)] set up nuget.config :art:
* [[#7c6bc44](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/7c6bc44065359371fc3c2ee1522b91b4154e7745)] Update test target.
* [[#c3af9d4](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/c3af9d4492a664f685d5b3e3e9ff659bd4df5cbb)] renam packages
* [[#240ed47](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/240ed4760d2d33a8106687e7e80be105fe498a7c)] try set up to use .fsproj in fornax
* [[#6f16a43](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/6f16a43dcfb516d36793e1274ad99e85d7e8ff27)] Initial commit
* [[#65ad6f6](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/65ad6f655ce2a1a22f366ae916d5e1fd870d8627)] Init fornax :tada:
* [[#49a0ff5](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/49a0ff5615ccd084d88856216ff57a10c18478ad)] add npm, add web-components, roll-up, bulma :tada:
Expand All @@ -23,6 +29,9 @@
* Deletions:
* [[#e7f99c1](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/e7f99c1748fa7e4b86f6c58e927ebe50014f8d7f)] delete most post logic and establish docs
* [[#ce316fe](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/ce316fe882632c100a938a998b3a695a7a80d794)] remove post code
* Bugfixes:
* [[#ee3b12a](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/ee3b12ae09d6cc5d2ea077e5c20240e7485dff3d)] Fix loader issues! :bug:
* [[#9b30791](https://github.com/Freymaurer/Nfdi4Plants.Fornax/commit/9b307917d099f72e737b6977d5a839b28aa2cb16)] try fix empty sitecontent issue

### 0.0.0 (Released 2022-6-13)
* Additions:
Expand Down
1 change: 1 addition & 0 deletions build/FornaxTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module FornaxTasks

open BlackFox.Fake
open Helpers
open Fake.Core

let watchFornax = BuildTask.create "fornax" [] {
// Sadly this did not work out. Was not possible to reference build .dll on hot reload. Maybe in the future
Expand Down
23 changes: 16 additions & 7 deletions build/PackageTasks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ open Fake.IO.Globbing.Operators

open System.IO

/// copy the fresh nuget packages to fornax test client dependency folder
let copy_nupkg() =
// copy the fresh nuget packages to fornax test client dependency folder
let files = Directory.GetFiles(pkgDir, "*.nupkg")
Trace.trace "Copy .nupkg files to test client dependency folder"
files |> Array.iter (fun x ->
let fileName = Path.GetFileName(x)
let fullPath = Path.GetFullPath(fornaxTestClientDependencies)
let targetFilePath = Path.Combine(fullPath, fileName)
if File.Exists targetFilePath then
File.Delete targetFilePath
File.Copy(x, targetFilePath)
)

let pack = BuildTask.create "Pack" [clean; build; runTests] {
if promptYesNo (sprintf "creating stable package with version %s OK?" stableVersionTag )
then
Expand All @@ -31,13 +45,7 @@ let pack = BuildTask.create "Pack" [clean; build; runTests] {
OutputPath = Some pkgDir
}
))
// // copy the fresh nuget packages to fornax test client dependency folder
// let files = Directory.GetFiles(pkgDir, "*.nupkg")
// files |> Array.iter (fun x ->
// let fileName = Path.GetFileName(x)
// printfn "%A" fileName
// File.Copy(x, Path.Combine(fornaxTestClientDependencies, fileName))
// )
copy_nupkg()
else failwith "aborted"
}

Expand All @@ -61,6 +69,7 @@ let packPrerelease = BuildTask.create "PackPrerelease" [setPrereleaseTag; clean;
MSBuildParams = msBuildParams
}
))
copy_nupkg()
else
failwith "aborted"
}
40 changes: 2 additions & 38 deletions client/generators/layout.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,44 +106,8 @@ let render (ctx : SiteContents) cnt =
|> fun n -> if disableLiveRefresh then n else injectWebsocketCode n

let docsLayout (docs: DocsData) =
let publishedDate = docs.published.Value.ToString("yyyy-MM-dd")
let sidebar = [
if Array.isEmpty docs.sidebar |> not then
for sidebarEle in docs.sidebar do
yield custom "nfdi-sidebar-element" [HtmlProperties.Custom ("slot", "sidebar"); HtmlProperties.Custom ("isActive","true") ] [
div [HtmlProperties.Custom ("slot", "title")] [!! sidebarEle.Title]
!! sidebarEle.Content
]
else ()
]
custom "nfdi-body" [Class "content"; if Array.isEmpty docs.sidebar |> not then HtmlProperties.Custom("hasSidebar", "true")] [
yield! sidebar

h1 [Class "front-header"] [!! docs.title]
i [Class "help" ] [!! $"last updated at {publishedDate}" ]

if docs.add_toc then custom "nfdi-toc" [] []
!! docs.content

// support contact
h3 [] [!! "Dataplant Support"]
div [] [
!! "Besides these technical solutions, DataPLANT supports you with community-engaged data stewardship. For further assistance, feel free to reach out via our "
a [Href "https://support.nfdi4plants.org"] [!! "helpdesk"]
!! " or by contacting us "
a [Href "javascript:location='mailto:\u0069\u006e\u0066\u006f\u0040\u006e\u0066\u0064\u0069\u0034\u0070\u006c\u0061\u006e\u0074\u0073\u002e\u006f\u0072\u0067';void 0"] [!! "directly"]
!! "."
]

// Edit this page link
div [] [
a [
Target "_blank"
Href $"https://github.com/nfdi4plants/nfdi4plants.github.io/tree/main/src/{docs.file}";
HtmlProperties.Style [MarginLeft "auto"; Display "block"; CSSProperties.Width "130px"]
] [!! "✏️ Edit this page"]
]
]
// just an example url
Components.docsLayout "https://github.com/nfdi4plants/nfdi4plants.github.io/tree/main/src/" docs

let docsMinimalLayout (docs: DocsData) =
div [Class "tile is-4 is-parent"] [
Expand Down
2 changes: 1 addition & 1 deletion client/loaders/docsloader.fsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#r "../_lib/Fornax.Core.dll"
#r "../_lib/Markdig.dll"
// This can be used to access local .nupkg, thanks to the nuget.config file.
#r "nuget: Nfdi4Plants.Fornax, 0.0.0"
#r "nuget: Nfdi4Plants.Fornax, 0.1.0"

open System.IO
open Fornax.Nfdi4Plants
Expand Down
52 changes: 52 additions & 0 deletions src/Nfdi4Plants.Fornax/Components.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace Fornax.Nfdi4Plants

open Html
open Docs

module Components =

/// <summary>Creates nfdi-webcomponent layout for documentation.</summary>
/// <param name="contentGithubUrl">Base path of fornax client. Is used to generate "Edit this page"-link</param>
/// <param name="docs">`DocsData` from generated by loaders.</param>
/// <returns>Returns `HtmlElement`. Best put as direct child of `&lt;body&gt;` element.</returns>
let docsLayout (contentGithubUrl:string) (docs: DocsData) =
let publishedDate = docs.published.Value.ToString("yyyy-MM-dd")
let sidebar = [
if Array.isEmpty docs.sidebar |> not then
for sidebarEle in docs.sidebar do
yield custom "nfdi-sidebar-element" [HtmlProperties.Custom ("slot", "sidebar"); HtmlProperties.Custom ("isActive","true") ] [
div [HtmlProperties.Custom ("slot", "title")] [!! sidebarEle.Title]
!! sidebarEle.Content
]
else ()
]
custom "nfdi-body" [Class "content"; if Array.isEmpty docs.sidebar |> not then HtmlProperties.Custom("hasSidebar", "true")] [
yield! sidebar

h1 [Class "front-header"] [!! docs.title]
i [Class "help" ] [!! $"last updated at {publishedDate}" ]

if docs.add_toc then custom "nfdi-toc" [] []
!! docs.content

// support contact
h3 [] [!! "Dataplant Support"]
div [] [
!! "Besides these technical solutions, DataPLANT supports you with community-engaged data stewardship. For further assistance, feel free to reach out via our "
a [Href "https://support.nfdi4plants.org"] [!! "helpdesk"]
!! " or by contacting us "
a [Href "javascript:location='mailto:\u0069\u006e\u0066\u006f\u0040\u006e\u0066\u0064\u0069\u0034\u0070\u006c\u0061\u006e\u0074\u0073\u002e\u006f\u0072\u0067';void 0"] [!! "directly"]
!! "."
]

// Edit this page link
// https://github.com/nfdi4plants/nfdi4plants.github.io/tree/main/src/
let editUrl = System.IO.Path.Combine(contentGithubUrl, docs.file)
div [] [
a [
Target "_blank"
Href editUrl;
HtmlProperties.Style [MarginLeft "auto"; Display "block"; CSSProperties.Width "130px"]
] [!! "✏️ Edit this page"]
]
]
19 changes: 7 additions & 12 deletions src/Nfdi4Plants.Fornax/Nfdi4Plants.Fornax.fsproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Authors>Kevin Frey, nfdi4plants</Authors>
<Title>Nfdi4Plants.Fornax</Title>
<Description>Loaders, web-component integration and general structures for the Nfdi4Plants documentation</Description>
<!-- <PackageLicenseExpression>MIT</PackageLicenseExpression> -->
<Icon>https://raw.githubusercontent.com/nfdi4plants/Branding/138420e3b6f9ec9e125c1ca8840874b2be2a1262/logos/DataPLANT_logo_minimal_rounded_bg_transparent.svg</Icon>
<PackageTags></PackageTags>
<PackageTags>
</PackageTags>
<RepositoryUrl>https://github.com/Freymaurer/nfdi4plants-fornax-template</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<!-- <FsDocsLicenseLink>https://github.com/nfdi4plants/ISADotNet/blob/developer/LICENSE</FsDocsLicenseLink>
<FsDocsReleaseNotesLink>https://github.com/nfdi4plants/ISADotNet/blob/developer/RELEASE_NOTES.md</FsDocsReleaseNotesLink> -->
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<Compile Include="MarkdigExtensions/nfdi-header.fs" />
<Compile Include="MarkdigExtensions/nfdi-sidebar-element-header.fs" />
<Compile Include="Loaders.fs" />
<Compile Include="Components.fs" />
</ItemGroup>


<ItemGroup>
<PackageReference Include="Markdig" Version="0.30.2" />
</ItemGroup>
Expand All @@ -33,12 +30,10 @@
<HintPath>_lib\Fornax.Core.dll</HintPath>
</Reference>
</ItemGroup>

<ItemGroup>
<Content Include="_lib\Fornax.Core.dll">
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
<Pack>true</Pack>
<PackagePath>lib\$(TargetFramework)</PackagePath>
</Content>
</ItemGroup>

</Project>
</Project>

0 comments on commit 682f790

Please sign in to comment.