Add icon view.

This commit is contained in:
Danila Fedorin 2018-12-10 16:16:39 -08:00
parent d855467f14
commit 42126c1489
4 changed files with 27 additions and 1 deletions

View File

@ -12,6 +12,7 @@
"elm/html": "1.0.0", "elm/html": "1.0.0",
"elm/http": "2.0.0", "elm/http": "2.0.0",
"elm/json": "1.1.2", "elm/json": "1.1.2",
"elm/svg": "1.0.1",
"elm/url": "1.0.0" "elm/url": "1.0.0"
}, },
"indirect": { "indirect": {

View File

@ -3,6 +3,8 @@ import Scylla.Model exposing (..)
import Scylla.Sync exposing (..) import Scylla.Sync exposing (..)
import Scylla.Route exposing (..) import Scylla.Route exposing (..)
import Scylla.Fnv as Fnv import Scylla.Fnv as Fnv
import Svg
import Svg.Attributes
import Url.Builder import Url.Builder
import Json.Decode as Decode import Json.Decode as Decode
import Html exposing (Html, div, input, text, button, div, span, a, h2, table, td, tr) import Html exposing (Html, div, input, text, button, div, span, a, h2, table, td, tr)
@ -98,7 +100,7 @@ joinedRoomView m roomId jr =
, onInput <| ChangeRoomText roomId , onInput <| ChangeRoomText roomId
, value <| Maybe.withDefault "" <| Dict.get roomId m.roomText , value <| Maybe.withDefault "" <| Dict.get roomId m.roomText
] [] ] []
, button [ onClick <| SendRoomText roomId ] [ text "Send" ] , button [ onClick <| SendRoomText roomId ] [ iconView "send" ]
] ]
in in
div [ class "room-wrapper" ] div [ class "room-wrapper" ]
@ -107,6 +109,15 @@ joinedRoomView m roomId jr =
, messageInput , messageInput
] ]
iconView : String -> Html Msg
iconView name =
let
url = Url.Builder.absolute [ "static", "svg", "feather-sprite.svg" ] []
in
Svg.svg
[ Svg.Attributes.class "feather-icon"
] [ Svg.use [ Svg.Attributes.xlinkHref (url ++ "#" ++ name) ] [] ]
eventWrapperView : Model -> List (Html Msg) -> Html Msg eventWrapperView : Model -> List (Html Msg) -> Html Msg
eventWrapperView m es = div [ class "events-wrapper" ] [ table [ class "events-table" ] es ] eventWrapperView m es = div [ class "events-wrapper" ] [ table [ class "events-table" ] es ]

View File

@ -155,3 +155,16 @@ span.sender-wrapper {
padding-right: 5px; padding-right: 5px;
float: right; float: right;
} }
/**
* Icons
*/
.feather-icon {
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
fill: none;
height: 20px;
width: 20px;
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 54 KiB