{-# LANGUAGE NoImplicitPrelude #-} module Bamboo.Theme.MiniHTML5.Widget.Navigation where import Bamboo.Theme.MiniHTML5.Env hiding (header, current, link) import qualified Bamboo.Type.Config as C import qualified Bamboo.Type.State as State import Bamboo.Helper (drop_known_extension) navigation :: Widget navigation s = nav [_class "site"] - do ul' - s.config.C.navigation.mapM_ nav_item where nav_item x = li [_class (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 = a [href - s.env.slashed_script_name] - str home_nav static_link = a [href - s.env.slashed_script_name / "static" / x] - str - x.drop_known_extension