all repos

onasty @ dc18a80

a one-time notes service

onasty/web/src/Components/Icon.elm (view raw)

Olexandr Smirnov Olexandr Smirnov
ss2316544@gmail.com
web: button component; improve code consistency (#168)..., 10 months ago
1
module Components.Icon exposing (IconType(..), view)
2
3
import Html as H exposing (Html)
4
import Html.Attributes as A
5
6
7
type IconType
8
    = NoteIcon
9
    | NotFound
10
    | Warning
11
12
13
view : IconType -> String -> Html msg
14
view t cls =
15
    let
16
        getHtml img =
17
            H.img [ A.src ("/static/" ++ img ++ ".svg"), A.class cls ] []
18
    in
19
    case t of
20
        NoteIcon ->
21
            getHtml "note-icon"
22
23
        NotFound ->
24
            getHtml "note-not-found"
25
26
        Warning ->
27
            getHtml "warning"