module Bamboo.Theme.MiniHTML5.Widget.Sidebar where
import Bamboo.Theme.MiniHTML5.Env
import Bamboo.Theme.MiniHTML5.Widget.Helper
import qualified Bamboo.Model.Tag as Tag
import qualified Bamboo.Type.Config as C
import qualified Bamboo.Type.State as State
import qualified Bamboo.Type.StaticWidget as Sidebar
import qualified Data.Set as Set
sidebar :: Widget
sidebar s =
aside [_class "sidebar"] do
section' do
header' str "Subscribe"
rss_url_link_pair s .snd
hr'
section' do
header' str "Tags"
ul' do
s.State.tags.Tag.sorted.mapM_ tag_link'
s.config.C.sidebar.mapM_ custom_side
where
custom_side x = do
hr'
section' do
header' str x.Sidebar.name
raw x.markup.show_html
tag_link' x = li' do
a [href s.env.slashed_script_name / x.Tag.uid] str x.Tag.name
str " (" ++ x.Tag.resources.Set.size.show ++ ")"