feat: refactored and added some stuff

This commit is contained in:
Nick 2024-12-12 22:48:20 -06:00
parent 7b8faede8d
commit 9f1a7fe872
17 changed files with 798 additions and 707 deletions

View file

@ -11,7 +11,7 @@ import Config.Helpers.Response
import Config.Helpers.ToolTip exposing (..)
import Config.Pages.Headers.Types exposing (..)
import Config.Pages.Services.Services.NixBuilds exposing (servicesNixBuilds)
import Config.Style.Colour exposing (colourTheme)
import Config.Style.Colour exposing (..)
import Config.Style.Transitions
exposing
( hoverFontDarkOrange
@ -50,7 +50,6 @@ toLayout model =
-- INIT
@ -131,11 +130,14 @@ serviceMaker =
[ cardSubTitleMaker
[ column
bodyFormat
[-- chunkMaker
-- , titleMaker
-- , highlightedBlockMaker
-- , bulletPointMaker
-- , numberMaker
[ chunkMaker servicesNixBuilds.serviceArticle.articleParagraph.paragraph1
, chunkMaker servicesNixBuilds.serviceArticle.articleParagraph.paragraph2
, titleMaker servicesNixBuilds.serviceArticle.articleTitles.title1
, numberMaker servicesNixBuilds.serviceArticle.articleListEntries.list1
, titleMaker servicesNixBuilds.serviceArticle.articleTitles.title2
, bulletPointMaker servicesNixBuilds.serviceArticle.articleListEntries.list2
, titleMaker servicesNixBuilds.serviceArticle.articleTitles.title3
, nixCodeRenderer
]
]
]
@ -143,3 +145,332 @@ serviceMaker =
]
]
]
renderCodeLine : SyntaxColors -> List (Element msg) -> Element msg
renderCodeLine colors elements =
paragraph
[ F.color colors.text
, F.alignLeft
, F.family
[ F.monospace ]
]
elements
nixCodeRenderer : Element msg
nixCodeRenderer =
el
[ paddingEach
{ top = 15
, bottom = 15
, left = 20
, right = 20
}
, B.color colourTheme.backgroundLightGrey
, D.rounded 10
, width fill
, spacing 8
]
<|
column
[ F.size 14
, spacing 5
, width fill
]
[ renderCodeLine syntaxTheme
[ text "{"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 8 0 ]
, text "description"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "\"Elm Environment\""
|> el [ F.color syntaxTheme.string ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 8 0 ]
, text "inputs"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "{"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "nixpkgs.url"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "\"github:NixOS/nixpkgs/nixos-unstable\""
|> el [ F.color syntaxTheme.string ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "nixpkgs-stable.url"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "\"github:NixOS/nixpkgs/nixos-23.11\""
|> el [ F.color syntaxTheme.string ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "haskell-flake.url"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "\"github:srid/haskell-flake\""
|> el [ F.color syntaxTheme.string ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 8 0 ]
, text "}"
|> el [ F.color syntaxTheme.punctuation ]
, text ";"
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 8 0 ]
, text "outputs"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "inputs"
|> el [ F.color syntaxTheme.keyword ]
, text " @ "
|> el [ F.color syntaxTheme.operator ]
, text "{"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "flake-parts"
|> el [ F.color syntaxTheme.keyword ]
, text ","
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "self"
|> el [ F.color syntaxTheme.keyword ]
, text ","
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "..."
|> el [ F.color syntaxTheme.operator ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 8 0 ]
, text "}"
|> el [ F.color syntaxTheme.punctuation ]
, text ": "
|> el [ F.color syntaxTheme.operator ]
, text "let"
|> el [ F.color syntaxTheme.keyword ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "system"
|> el [ F.color syntaxTheme.keyword ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "\"x86_64-linux\""
|> el [ F.color syntaxTheme.string ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 8 0 ]
, text "in"
|> el [ F.color syntaxTheme.keyword ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "flake-parts.lib.mkFlake"
|> el [ F.color syntaxTheme.keyword ]
, text " { "
|> el [ F.color syntaxTheme.punctuation ]
, text "inherit inputs"
|> el [ F.color syntaxTheme.keyword ]
, text " } "
|> el [ F.color syntaxTheme.punctuation ]
, text "{"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 24 0 ]
, text "imports"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "["
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 32 0 ]
, text "./parts"
|> el [ F.color syntaxTheme.string ]
, text ","
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 32 0 ]
, text "inputs.haskell-flake.flakeModule"
|> el [ F.color syntaxTheme.keyword ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 24 0 ]
, text "]"
|> el [ F.color syntaxTheme.punctuation ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 24 0 ]
, text "systems"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "[ "
|> el [ F.color syntaxTheme.punctuation ]
, text "system"
|> el [ F.color syntaxTheme.keyword ]
, text " ]"
|> el [ F.color syntaxTheme.punctuation ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 24 0 ]
, text "perSystem"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "{ "
|> el [ F.color syntaxTheme.punctuation ]
, text "pkgs"
|> el [ F.color syntaxTheme.keyword ]
, text ", ... "
|> el [ F.color syntaxTheme.operator ]
, text "} "
|> el [ F.color syntaxTheme.punctuation ]
, text ": "
|> el [ F.color syntaxTheme.operator ]
, text "{"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 32 0 ]
, text "_module.args.pkgs"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "import"
|> el [ F.color syntaxTheme.keyword ]
, text " inputs.nixpkgs "
|> el [ F.color syntaxTheme.keyword ]
, text "{ "
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 40 0 ]
, text "inherit system"
|> el [ F.color syntaxTheme.key ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 32 0 ]
, text "}"
|> el [ F.color syntaxTheme.punctuation ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 32 0 ]
, text "_module.args.pkgs-stable"
|> el [ F.color syntaxTheme.key ]
, text " = "
|> el [ F.color syntaxTheme.operator ]
, text "import"
|> el [ F.color syntaxTheme.keyword ]
, text " inputs.nixpkgs-stable "
|> el [ F.color syntaxTheme.keyword ]
, text "{ "
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 40 0 ]
, text "inherit system"
|> el [ F.color syntaxTheme.key ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 32 0 ]
, text "}"
|> el [ F.color syntaxTheme.punctuation ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 24 0 ]
, text "}"
|> el [ F.color syntaxTheme.punctuation ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text ""
|> el [ paddingXY 16 0 ]
, text "}"
|> el [ F.color syntaxTheme.punctuation ]
, text ";"
|> el [ F.color syntaxTheme.punctuation ]
]
, renderCodeLine syntaxTheme
[ text "}"
|> el [ F.color syntaxTheme.punctuation ]
]
]