mirror of
https://github.com/correl/elm-mdl.git
synced 2024-11-23 19:19:52 +00:00
misc
This commit is contained in:
parent
bb8e2d6419
commit
32626b09e9
4 changed files with 22 additions and 21 deletions
6
Makefile
6
Makefile
|
@ -1,4 +1,4 @@
|
||||||
PAGES=../../elm-mdl-gh-pages
|
PAGES=../elm-mdl-gh-pages
|
||||||
|
|
||||||
comp:
|
comp:
|
||||||
elm-make examples/Component.elm --warn --output elm.js
|
elm-make examples/Component.elm --warn --output elm.js
|
||||||
|
@ -10,11 +10,11 @@ docs:
|
||||||
elm-make --docs=docs.json
|
elm-make --docs=docs.json
|
||||||
|
|
||||||
wip-pages :
|
wip-pages :
|
||||||
(cd demo; elm-make Demo.elm --output $(PAGES)/wip.js)
|
(cd demo; elm-make Demo.elm --output ../$(PAGES)/wip.js)
|
||||||
(cd $(PAGES); git commit -am "Update."; git push origin gh-pages)
|
(cd $(PAGES); git commit -am "Update."; git push origin gh-pages)
|
||||||
|
|
||||||
pages :
|
pages :
|
||||||
elm-make examples/Demo.elm --output $(PAGES)/elm.js
|
(cd demo; elm-make Demo.elm --output ../$(PAGES)/elm.js)
|
||||||
(cd $(PAGES); git commit -am "Update."; git push origin gh-pages)
|
(cd $(PAGES); git commit -am "Update."; git push origin gh-pages)
|
||||||
|
|
||||||
cleanish :
|
cleanish :
|
||||||
|
|
|
@ -152,8 +152,10 @@ body1 t srcUrl contents links demo =
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
body2 : String -> String -> Html -> List (String, String) -> List Html -> Html
|
||||||
body2 = body1
|
body2 = body1
|
||||||
|
|
||||||
|
|
||||||
body3 : String -> String -> Html -> List (String, String) -> List Html -> Html
|
body3 : String -> String -> Html -> List (String, String) -> List Html -> Html
|
||||||
body3 t srcUrl contents links demo =
|
body3 t srcUrl contents links demo =
|
||||||
div
|
div
|
||||||
|
|
|
@ -160,7 +160,7 @@ view addr model =
|
||||||
|> List.map (\c ->
|
|> List.map (\c ->
|
||||||
cell
|
cell
|
||||||
[size All 4, offset Desktop 1]
|
[size All 4, offset Desktop 1]
|
||||||
[c.view addr model.mdl]
|
[c.view addr model.mdl []]
|
||||||
)
|
)
|
||||||
|> List.intersperse (cell [size All 1] [])
|
|> List.intersperse (cell [size All 1] [])
|
||||||
|> grid []
|
|> grid []
|
||||||
|
|
|
@ -46,6 +46,7 @@ import Html.Events exposing (..)
|
||||||
import Effects
|
import Effects
|
||||||
|
|
||||||
import Material.Helpers exposing (filter)
|
import Material.Helpers exposing (filter)
|
||||||
|
import Material.Style as Style exposing (cs, cs', Style)
|
||||||
import Material.Component as Component exposing (Indexed)
|
import Material.Component as Component exposing (Indexed)
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,25 +139,23 @@ update action model =
|
||||||
|
|
||||||
{-| Component view.
|
{-| Component view.
|
||||||
-}
|
-}
|
||||||
view : Signal.Address Action -> Model -> Html
|
view : Signal.Address Action -> Model -> List Style -> Html
|
||||||
-- TODO: Should take Style argument.
|
view addr model styles =
|
||||||
view addr model =
|
|
||||||
let hasFloat = model.label |> Maybe.map .float |> Maybe.withDefault False
|
let hasFloat = model.label |> Maybe.map .float |> Maybe.withDefault False
|
||||||
hasError = model.error |> Maybe.map (always True) |> Maybe.withDefault False
|
hasError = model.error |> Maybe.map (always True) |> Maybe.withDefault False
|
||||||
labelText = model.label |> Maybe.map .text
|
labelText = model.label |> Maybe.map .text
|
||||||
in
|
in
|
||||||
filter div
|
filter Style.div
|
||||||
[ classList
|
( cs "mdl-textfield"
|
||||||
[ ("mdl-textfield", True)
|
:: cs "mdl-js-textfield"
|
||||||
, ("mdl-js-textfield", True)
|
:: cs "is-upgraded"
|
||||||
, ("is-upgraded", True)
|
:: cs' "mdl-textfield--floating-label" hasFloat
|
||||||
, ("mdl-textfield--floating-label", hasFloat)
|
:: cs' "is-invalid" hasError
|
||||||
, ("is-invalid", hasError)
|
:: cs' "is-dirty" (model.value /= "")
|
||||||
, ("is-dirty", model.value /= "")
|
:: cs' "is-focused" (model.isFocused && not model.isDisabled)
|
||||||
, ("is-focused", model.isFocused && not model.isDisabled)
|
:: cs' "is-disabled" model.isDisabled
|
||||||
, ("is-disabled", model.isDisabled)
|
:: styles
|
||||||
]
|
)
|
||||||
]
|
|
||||||
[ Just <| input
|
[ Just <| input
|
||||||
[ class "mdl-textfield__input"
|
[ class "mdl-textfield__input"
|
||||||
, style [ ("outline", "none") ]
|
, style [ ("outline", "none") ]
|
||||||
|
@ -191,7 +190,7 @@ type alias Container c =
|
||||||
{-|
|
{-|
|
||||||
-}
|
-}
|
||||||
type alias Instance container obs =
|
type alias Instance container obs =
|
||||||
Component.Instance Model container Action obs Html
|
Component.Instance Model container Action obs (List Style -> Html)
|
||||||
|
|
||||||
|
|
||||||
{-| Component constructor. See module `Material`.
|
{-| Component constructor. See module `Material`.
|
||||||
|
|
Loading…
Reference in a new issue