2019-10-30 04:47:38 +03:00
|
|
|
module Examples.IconExamples exposing (view, viewWithCustomStyles)
|
2019-10-01 03:16:29 +03:00
|
|
|
|
|
|
|
import Css
|
|
|
|
import Html.Styled as Html exposing (Html)
|
|
|
|
import Html.Styled.Attributes exposing (css, style, title)
|
|
|
|
import Nri.Ui.Colors.V1 as Colors
|
|
|
|
import Nri.Ui.Heading.V2 as Heading
|
2019-10-30 01:54:59 +03:00
|
|
|
import Nri.Ui.Svg.V1 as Svg
|
2019-10-01 03:16:29 +03:00
|
|
|
import Nri.Ui.Text.V4 as Text
|
|
|
|
|
|
|
|
|
2019-10-30 01:54:59 +03:00
|
|
|
view : String -> List ( String, Svg.Svg ) -> Html msg
|
2019-10-01 19:04:33 +03:00
|
|
|
view headerText icons =
|
2019-10-30 04:47:38 +03:00
|
|
|
let
|
|
|
|
defaultStyles =
|
|
|
|
[ Css.height (Css.px 25)
|
|
|
|
, Css.width (Css.px 25)
|
|
|
|
, Css.margin (Css.px 4)
|
|
|
|
, Css.color Colors.gray45
|
|
|
|
]
|
|
|
|
in
|
|
|
|
viewWithCustomStyles headerText
|
|
|
|
(List.map (\( name, svg ) -> ( name, svg, defaultStyles )) icons)
|
|
|
|
|
|
|
|
|
|
|
|
viewWithCustomStyles : String -> List ( String, Svg.Svg, List Css.Style ) -> Html msg
|
|
|
|
viewWithCustomStyles headerText icons =
|
2019-10-30 02:24:20 +03:00
|
|
|
Html.section [ css [ Css.displayFlex, Css.alignItems Css.center ] ]
|
|
|
|
[ Html.div
|
|
|
|
[ css
|
|
|
|
[ Css.displayFlex
|
|
|
|
, Css.flexWrap Css.wrap
|
|
|
|
]
|
|
|
|
]
|
2019-10-01 03:16:29 +03:00
|
|
|
(List.map viewIcon icons)
|
2019-10-30 02:24:20 +03:00
|
|
|
, Heading.h2
|
|
|
|
[ Heading.css
|
2019-10-30 04:54:39 +03:00
|
|
|
[ Css.marginLeft (Css.px 32)
|
2019-10-30 02:24:20 +03:00
|
|
|
, Css.paddingLeft (Css.px 32)
|
|
|
|
, Css.borderLeft3 (Css.px 2) Css.solid Colors.gray92
|
|
|
|
, Css.fontSize (Css.px 16)
|
|
|
|
]
|
|
|
|
]
|
|
|
|
[ Html.text headerText ]
|
2019-10-01 03:16:29 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
|
2019-10-30 04:47:38 +03:00
|
|
|
viewIcon : ( String, Svg.Svg, List Css.Style ) -> Html msg
|
|
|
|
viewIcon ( name, icon, style ) =
|
2019-10-01 03:16:29 +03:00
|
|
|
Html.div
|
|
|
|
[ css
|
2019-10-30 02:24:20 +03:00
|
|
|
[ Css.displayFlex
|
2019-10-01 03:16:29 +03:00
|
|
|
, Css.alignItems Css.center
|
2019-10-30 02:24:20 +03:00
|
|
|
, Css.margin (Css.px 8)
|
2019-10-01 03:16:29 +03:00
|
|
|
]
|
|
|
|
]
|
2019-10-30 04:47:38 +03:00
|
|
|
[ Html.div [ css style ] [ Svg.toHtml icon ]
|
2019-10-30 01:54:59 +03:00
|
|
|
, Text.smallBody [ Html.text name ]
|
2019-10-01 03:16:29 +03:00
|
|
|
]
|