Last active
October 21, 2016 14:11
-
-
Save giisyu/6463ce002c80e29bc70b95bb45401b29 to your computer and use it in GitHub Desktop.
Elmでマテリアルデザイン ref: http://qiita.com/jooex/items/c4f9b6dcc8014803456e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| elm-package install debois/elm-mdl -y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500|Roboto+Mono|Roboto+Condensed:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'> | |
| <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | |
| <link rel="stylesheet" href="https://code.getmdl.io/1.2.0/material.teal-red.min.css" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <link href='https://fonts.googleapis.com/css?family=Roboto:400,300,500|Roboto+Mono|Roboto+Condensed:400,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'> | |
| <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> | |
| <link rel="stylesheet" href="https://code.getmdl.io/1.2.0/material.teal-red.min.css" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... model = | |
| {要素}.render Mdl -- Msgで設定したMdl | |
| [ n , ..] -- インデックス。どのパーツかの判断用 | |
| model.mdl -- modelで設定したmdlを渡す | |
| [ ... -- Optionを付ける。cssとかイベントとかをつけたり、要素毎の設定がある。 | |
| , ... | |
| , ... ] | |
| [ .. -- 子要素。Titleなど要素毎に決まった入れるものがあったりする。 | |
| , .. | |
| ] | |
| ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Material.Tabs as Tabs | |
| menuTab model = | |
| Tabs.render Mdl | |
| [ 5, 2 ] | |
| model.mdl | |
| [ Tabs.ripple | |
| , Tabs.onSelectTab SetTab | |
| , Tabs.activeTab model.tab | |
| ] | |
| [ Tabs.label [] [ text "basic" ] | |
| , Tabs.label [] [ text "" ] | |
| ] | |
| [ heroParaTable model ] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main exposing(..) | |
| import Html exposing (text) | |
| import Html.App exposing(program) | |
| main = program {init = init , update = update , view = view ,subscriptions = subscriptions} | |
| init = "" ! [] | |
| update msg model = model ! [] | |
| view model = text "hello" | |
| subscriptions model = Sub.none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Material | |
| import Material.Button as Button | |
| import Material.Options as Options exposing (css) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type alias Model = { mdl : Material.Model } | |
| init : ( Model,Cmd a ) | |
| init = { mdl = Material.model } ! [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Msg = Mdl ((Material.Msg Msg)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| update msg model = | |
| case msg of | |
| Mdl msg' -> Material.update msg' model | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Main exposing(..) | |
| import Html exposing (text) | |
| import Html.App exposing(program) | |
| import Html.Attributes exposing (href, class, style) | |
| import Material | |
| import Material.Scheme | |
| import Material.Button as Button | |
| import Material.Options as Options exposing (css) | |
| main = program {init = init , update = update , view = view ,subscriptions = subscriptions} | |
| type alias Model = {mdl :Material.Model } | |
| type Msg = Mdl ((Material.Msg Msg)) | |
| init : (Model,Cmd a) | |
| init = {mdl = Material.model } ! [] | |
| update msg model = | |
| case msg of | |
| Mdl msg' -> Material.update msg' model | |
| view model = text "hello" | |
| subscriptions model = Sub.none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Material.List as Lists | |
| view model = | |
| Lists.ul [] | |
| <| List.indexedMap element model.data | |
| element index data = | |
| Lists.li [Lists.withBody] | |
| [ Lists.content [] [ text data.supplier | |
| , Lists.body [] [ text data.address ] ] | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Material.Options as Options exposing (css) | |
| wrapCss = | |
| [ css "position" "fixed" | |
| , css "width" "100%" | |
| ] | |
| allWrap model = | |
| Options.div | |
| wrapCss | |
| [ allView model ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment