mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-09-11 23:57:22 +03:00
padAll, padTopBottom, and padLeftRight all now only take integer padding arguments
This commit is contained in:
parent
4310231caa
commit
648abfcacc
@ -23,7 +23,7 @@ data Choice = Red | Blue | Green
|
||||
drawUI :: D.Dialog Choice -> [Widget]
|
||||
drawUI d = [ui]
|
||||
where
|
||||
ui = D.renderDialog d $ C.hCenter $ padAll (Pad 1) $ str "This is the dialog body."
|
||||
ui = D.renderDialog d $ C.hCenter $ padAll 1 $ str "This is the dialog body."
|
||||
|
||||
appEvent :: D.Dialog Choice -> V.Event -> M.EventM (M.Next (D.Dialog Choice))
|
||||
appEvent d ev =
|
||||
|
@ -33,14 +33,14 @@ ui =
|
||||
, padBottom Max $ hCenter "Bottom-padded"
|
||||
]
|
||||
, B.hBorder
|
||||
, hBox [ padLeftRight (Pad 2) "Padded by 2 on left/right"
|
||||
, hBox [ padLeftRight 2 "Padded by 2 on left/right"
|
||||
, B.vBorder
|
||||
, vBox [ padTopBottom (Pad 1) "Padded by 1 on top/bottom"
|
||||
, vBox [ padTopBottom 1 "Padded by 1 on top/bottom"
|
||||
, B.hBorder
|
||||
]
|
||||
]
|
||||
, B.hBorder
|
||||
, padAll (Pad 2) "Padded by 2 on all sides"
|
||||
, padAll 2 "Padded by 2 on all sides"
|
||||
]
|
||||
|
||||
app :: App () V.Event
|
||||
|
@ -338,16 +338,16 @@ padBottom padding p =
|
||||
(f $ hLimit (result^.image.to V.imageWidth) $ fill ' ')
|
||||
|
||||
-- | Pad a widget on the left and right.
|
||||
padLeftRight :: Padding -> Widget -> Widget
|
||||
padLeftRight p w = padLeft p $ padRight p w
|
||||
padLeftRight :: Int -> Widget -> Widget
|
||||
padLeftRight c w = padLeft (Pad c) $ padRight (Pad c) w
|
||||
|
||||
-- | Pad a widget on the top and bottom.
|
||||
padTopBottom :: Padding -> Widget -> Widget
|
||||
padTopBottom p w = padTop p $ padBottom p w
|
||||
padTopBottom :: Int -> Widget -> Widget
|
||||
padTopBottom r w = padTop (Pad r) $ padBottom (Pad r) w
|
||||
|
||||
-- | Pad a widget on all sides.
|
||||
padAll :: Padding -> Widget -> Widget
|
||||
padAll p w = padLeftRight p $ padTopBottom p w
|
||||
padAll :: Int -> Widget -> Widget
|
||||
padAll v w = padLeftRight v $ padTopBottom v w
|
||||
|
||||
-- | Fill all available space with the specified character. Grows both
|
||||
-- horizontally and vertically.
|
||||
|
Loading…
Reference in New Issue
Block a user