github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/web/elm/src/Views/Icon.elm (about)

     1  module Views.Icon exposing (icon, iconWithTooltip)
     2  
     3  import Assets
     4  import Html exposing (Html)
     5  import Html.Attributes exposing (style)
     6  
     7  
     8  icon :
     9      { sizePx : Int, image : Assets.Asset }
    10      -> List (Html.Attribute msg)
    11      -> Html msg
    12  icon { sizePx, image } attrs =
    13      iconWithTooltip { sizePx = sizePx, image = image } attrs []
    14  
    15  
    16  iconWithTooltip :
    17      { sizePx : Int, image : Assets.Asset }
    18      -> List (Html.Attribute msg)
    19      -> List (Html msg)
    20      -> Html msg
    21  iconWithTooltip { sizePx, image } attrs tooltipContent =
    22      Html.div
    23          ([ style "background-image" <|
    24              Assets.backgroundImage <|
    25                  Just image
    26           , style "height" (String.fromInt sizePx ++ "px")
    27           , style "width" (String.fromInt sizePx ++ "px")
    28           , style "background-position" "50% 50%"
    29           , style "background-repeat" "no-repeat"
    30           ]
    31              ++ attrs
    32          )
    33          tooltipContent