Commit e0347d4a authored by Fabien Manière's avatar Fabien Manière

factorise a little

parent 0e0333be
Pipeline #4508 failed with stage
in 0 seconds
...@@ -420,6 +420,12 @@ type FolderIconProps = ...@@ -420,6 +420,12 @@ type FolderIconProps =
, isLeaf :: Boolean , isLeaf :: Boolean
) )
handedPartClassName :: Handed -> String
handedPartClassName = case _ of
LeftHanded -> "angle-left"
RightHanded -> "angle-right"
folderIcon :: R2.Leaf FolderIconProps folderIcon :: R2.Leaf FolderIconProps
folderIcon = R2.leaf folderIconCpt folderIcon = R2.leaf folderIconCpt
folderIconCpt :: R.Component FolderIconProps folderIconCpt :: R.Component FolderIconProps
...@@ -432,12 +438,6 @@ folderIconCpt = here.component "folderIcon" cpt where ...@@ -432,12 +438,6 @@ folderIconCpt = here.component "folderIcon" cpt where
handed' <- R2.useLive' handed handed' <- R2.useLive' handed
-- | Computed -- | Computed
-- | -- |
let
handedClassName :: Handed -> String
handedClassName = case _ of
LeftHanded -> "angle-left"
RightHanded -> "angle-right"
pure $ pure $
B.icon B.icon
...@@ -445,7 +445,7 @@ folderIconCpt = here.component "folderIcon" cpt where ...@@ -445,7 +445,7 @@ folderIconCpt = here.component "folderIcon" cpt where
["mainleaf__folder-icon" ["mainleaf__folder-icon"
, "mainleaf__folder-icon--leaf" , "mainleaf__folder-icon--leaf"
] ]
, name: handedClassName handed' , name: handedPartClassName handed'
} }
cpt { callback, isOpened } _ = do cpt { callback, isOpened } _ = do
...@@ -456,18 +456,11 @@ folderIconCpt = here.component "folderIcon" cpt where ...@@ -456,18 +456,11 @@ folderIconCpt = here.component "folderIcon" cpt where
handed' <- R2.useLive' handed handed' <- R2.useLive' handed
-- | Computed -- | Computed
-- | -- |
let
handedClassName :: Handed -> String
handedClassName = case _ of
LeftHanded -> "angle-left"
RightHanded -> "angle-right"
pure $ pure $
B.iconButton B.iconButton
{ className: "mainleaf__folder-icon" { className: "mainleaf__folder-icon"
, name: isOpened ? "angle-down" $ handedClassName handed' , name: isOpened ? "angle-down" $ handedPartClassName handed'
, overlay: false , overlay: false
, callback , callback
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment