aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home/View/Expand.elm
blob: 514bf9322f91149ad9641a924432bc82e981916f (plain)
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
module LoggedIn.Home.View.Expand
  ( expand
  , ExpandType(..)
  ) where

import Html exposing (..)
import Html.Attributes exposing (..)

import View.Icon exposing (renderIcon)

type ExpandType = ExpandUp | ExpandDown

expand : ExpandType -> Bool -> Html
expand expandType isExpanded =
  div
    [ class "expand" ]
    [ renderIcon (chevronIcon expandType isExpanded) ]

chevronIcon : ExpandType -> Bool -> String
chevronIcon expandType isExpanded =
  case (expandType, isExpanded) of
    (ExpandUp, True)    -> "chevron-down"
    (ExpandUp, False)   -> "chevron-up"
    (ExpandDown, True)  -> "chevron-up"
    (ExpandDown, False) -> "chevron-down"