1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
module Main where
#if !(MIN_VERSION_base(4,11,0))
import Data.Monoid ((<>))
#endif
import Brick
import Brick.Widgets.Table
import Brick.Widgets.Center (center)
ui :: Widget ()
ui = center $ renderTable leftTable <+>
padLeft (Pad 5) (renderTable rightTableA <=>
renderTable rightTableB <=>
renderTable rightTableC)
innerTable :: Table ()
innerTable =
surroundingBorder False $
table [ [txt "inner", txt "table"]
, [txt "is", txt "here"]
]
leftTable :: Table ()
leftTable =
alignCenter 1 $
alignRight 2 $
alignMiddle 2 $
table [ [txt "Left", txt "Center", txt "Right"]
, [txt "X", txt "Some things", txt "A"]
, [renderTable innerTable, txt "are", txt "B"]
, [txt "Z", txt "centered", txt "C"]
]
rightTableA :: Table ()
rightTableA =
rowBorders False $
setDefaultColAlignment AlignCenter $
table [ [txt "A", txt "without"]
, [txt "table", txt "row borders"]
]
rightTableB :: Table ()
rightTableB =
columnBorders False $
setDefaultColAlignment AlignCenter $
table [ [txt "A", txt "table"]
, [txt "without", txt "column borders"]
]
rightTableC :: Table ()
rightTableC =
surroundingBorder False $
rowBorders False $
columnBorders False $
setDefaultColAlignment AlignCenter $
table [ [txt "A", txt "table"]
, [txt "without", txt "any borders"]
]
main :: IO ()
main = simpleMain ui
|