dotfiles/packages/website/frontend/src/Config/Helpers/Cards/Inner/StrengthBar.elm

77 lines
1.8 KiB
Elm
Executable file
Vendored

module Config.Helpers.Cards.Inner.StrengthBar exposing
( barMaker
, barPadding
)
import Config.Helpers.Cards.Inner.ToolTip
exposing
( ToolTipPosition(..)
, tooltip
)
import Config.Style.Colour.Helpers exposing (colourTheme)
import Element as E
exposing
( Device
, DeviceClass(..)
, Element
, Orientation(..)
, alignLeft
, column
, el
, fill
, height
, none
, px
, width
)
import Element.Background as B exposing (gradient)
import Element.Border as D
exposing
( color
, rounded
, width
)
import Shared exposing (Model)
barMaker : Shared.Model -> (Int -> String) -> Int -> Element msg
barMaker shared getTooltip num =
let
strengthBarAttr =
[ height <| px 12
, E.width fill
, D.rounded 10
, D.color colourTheme.textDarkGrey
, D.width 2
, B.gradient
{ angle = 1.57
, steps =
List.concat
[ List.repeat num colourTheme.barGreen
, List.repeat (10 - num) colourTheme.barRed
]
}
]
in
el
(strengthBarAttr
++ (case ( shared.device.class, shared.device.orientation ) of
( Phone, Portrait ) ->
[]
( Tablet, Portrait ) ->
[]
_ ->
[ tooltip IsLeft (getTooltip num) ]
)
)
none
barPadding : List (Element msg) -> Element msg
barPadding =
column
[ E.width fill
, alignLeft
]