aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/LoggedIn/Home/View/Expand.elm
blob: a50ebfe6d5156b501c8d780e254883e0760f1b75 (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
26
27
module LoggedIn.Home.View.Expand exposing
  ( expand
  , ExpandType(..)
  )

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

import Msg exposing (Msg)

import View.Icon exposing (renderIcon)

type ExpandType = ExpandUp | ExpandDown

expand : ExpandType -> Bool -> Html Msg
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"