add fun fact to homepage

This commit is contained in:
Daylin Morgan 2024-11-25 10:01:42 -06:00
parent 81cfcaea17
commit 77dbe8af05
Signed by: daylin
GPG key ID: 950D13E9719334AD

View file

@ -1,12 +1,27 @@
import std/[sequtils, strutils, strformat]
import karax/[karaxdsl, vdom] import karax/[karaxdsl, vdom]
import ../components/[search, tag, package] 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 = proc render*(): VNode =
result = buildHtml(tdiv(class = "justify-center")): result = buildHtml(tdiv(class = "justify-center")):
tdiv(class = "flex flex-col space-y-5"): tdiv(class = "flex flex-col space-y-5"):
tdiv(class = "md:text-4xl text-2xl font-bold font-mono-casual text-center"): tdiv(class = "text-center"):
text "discover Nim's ecosystem of third-party libraries and tools" 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 = "grow md:w-4/5 mx-auto"):
tdiv(class = "flex flex-col md:flex-row grow"): tdiv(class = "flex flex-col md:flex-row grow"):
searchBar() searchBar()
@ -19,4 +34,3 @@ proc render*(): VNode =
tdiv(): tdiv():
tdiv(): text "recently released versions:" tdiv(): text "recently released versions:"
recentPackageVersionsList() recentPackageVersionsList()