bamboo-2009.6.6: src/Bamboo/View/Widget/Navigation.hs
{-# LANGUAGE NoImplicitPrelude #-}
module Bamboo.View.Widget.Navigation where
import Bamboo.View.Env hiding (header, current, link)
import qualified Bamboo.Type.State as State
import qualified Bamboo.Type.Config as C
import qualified Bamboo.Type.Theme as T
navigation :: Widget
navigation s =
div_class_id (s.config.theme.T.navigation) "nav" <<
div_class "content" <<
ulist << s.config.C.navigation.map nav_item
where
nav_item x =
li ! [theclass (home_tag ++ "page_item" ++ current)]
<< link
where
nav = s.State.nav_location
home_tag = if x == home_nav then "first " else ""
current = if x == nav then " current_page_item" else ""
link = if x == home_nav then home_link else static_link
home_link = hotlink (s.config.root) << home_nav
static_link = hotlink (s.config.root / "static" / x)
<< x.drop_known_extension