module Panda.View.Widget.Navigation where
import Panda.Helper.Env hiding (header)
import qualified Panda.Config.Global as G
import qualified Panda.Type.State as State
navigation c state =
div_class_id c "nav" <<
div_class "content" <<
ulist << G.navigation.map (nav_item (state.State.nav_location))
nav_item nav s = li ! [theclass (home_tag ++ "page_item" ++ current)] << link s where
home_tag = if s == home_nav then "first " else ""
current = if s == nav then " current_page_item" else ""
link x = if x == home_nav then home_link else static_link x
home_link = hotlink G.root << home_nav
static_link s = hotlink (G.root / "static" / s) << s.drop_known_extension