{-# LANGUAGE NamedFieldPuns #-}
module FortyTwo.Renderers.Select (renderOptions, renderOption) where
import FortyTwo.Types (Option(..), Options)
import System.Console.ANSI
import FortyTwo.Utils (addBreakingLinesSpacing)
import FortyTwo.Constants
renderOptions :: Options -> IO ()
renderOptions = mapM_ renderOption
renderOption :: Option -> IO()
renderOption Option { isFocused, value } =
if isFocused then do
setSGR [SetColor Foreground Dull Cyan]
putStrLn $ unwords [[focusIcon], text]
setSGR [Reset]
else
putStrLn $ separator ++ text
where
separator = " "
text = addBreakingLinesSpacing separator value