blob: 5750cdc805cef52cb3c979bca3d14f4018d84580 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
module Brick.Widgets.DefnList (defnList) where
import Brick.Types
import Brick.Widgets.Core
defnList :: [(String, String)] -> Widget ()
defnList defns = vBox $ line <$> defns
where
line (label, content) = str $
label ++ sep ++ (gap label content) ++ content
gap a b = take (maxWidth - length a - length b - length sep) $ repeat ' '
maxWidth = maximum $ map (\(x,y) -> length sep + length x + length y) defns
sep = ": "
|