aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Expand.elm
blob: 53b4fe5516e8d88a5428e1dcfbcb9712195414ea (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 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"