From 77dbe8af055a01e21b8869c8d947d9ce85cf42b3 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Mon, 25 Nov 2024 10:01:42 -0600 Subject: [PATCH] add fun fact to homepage --- src/pages/index.nim | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/pages/index.nim b/src/pages/index.nim index b2032f6..a7b7140 100644 --- a/src/pages/index.nim +++ b/src/pages/index.nim @@ -1,12 +1,27 @@ +import std/[sequtils, strutils, strformat] import karax/[karaxdsl, vdom] - import ../components/[search, tag, package] +import ../context + +# TODO: add more "fun" facts? +proc getFact(): string = + let nPackages = nimpkgsList().filterIt("nim" in toLowerAscii($it.name)).len() + result = fmt"Currently {nPackages} packages use the word nim!" + +proc funFact(): VNode = + buildHtml(tdiv): + span(class = "font-bold"): text "Fun Fact" + text ": " + text getFact() + proc render*(): VNode = result = buildHtml(tdiv(class = "justify-center")): tdiv(class = "flex flex-col space-y-5"): - tdiv(class = "md:text-4xl text-2xl font-bold font-mono-casual text-center"): - text "discover Nim's ecosystem of third-party libraries and tools" + tdiv(class = "text-center"): + tdiv(class = "md:text-4xl text-2xl font-bold font-mono-casual my-1"): + text "discover Nim's ecosystem of third-party libraries and tools" + funFact() tdiv(class = "grow md:w-4/5 mx-auto"): tdiv(class = "flex flex-col md:flex-row grow"): searchBar() @@ -19,4 +34,3 @@ proc render*(): VNode = tdiv(): tdiv(): text "recently released versions:" recentPackageVersionsList() -