packages feed

bamboo-theme-blueprint-2009.6.8: src/Bamboo/Theme/Blueprint/Widget/Navigation.hs

{-# LANGUAGE NoImplicitPrelude #-}
module Bamboo.Theme.Blueprint.Widget.Navigation where
  
import Bamboo.Theme.Blueprint.Env hiding (header, current, link)
import qualified Bamboo.Type.Config as C
import qualified Bamboo.Type.State as State

navigation :: Widget
navigation s = 
  div_class_id "column span-12 first large" "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