mirror of
https://github.com/nunntom/elm-ui-select.git
synced 2024-11-22 21:19:26 +03:00
Tidy up examples
This commit is contained in:
parent
8c15d68e3e
commit
da1e069f8c
@ -5,7 +5,6 @@ import Countries exposing (Country)
|
||||
import Element
|
||||
import Element.Input as Input
|
||||
import Html exposing (Html)
|
||||
import Html.Attributes
|
||||
import Resources.ClearButton
|
||||
import Select exposing (Select)
|
||||
import Select.Effect
|
||||
@ -46,7 +45,7 @@ view model =
|
||||
]
|
||||
[ Select.view []
|
||||
{ onChange = CountrySelectMsg
|
||||
, label = Input.labelAbove [ Element.htmlAttribute <| Html.Attributes.for (Select.toInputElementId model.countrySelect) ] (Element.text "Choose a country")
|
||||
, label = Input.labelAbove [] (Element.text "Choose a country")
|
||||
, placeholder = Just (Input.placeholder [] (Element.text "Type to search"))
|
||||
, itemToString = \c -> c.flag ++ " " ++ c.name
|
||||
}
|
||||
|
@ -5,9 +5,8 @@ import Countries exposing (Country)
|
||||
import Element
|
||||
import Element.Input as Input
|
||||
import Html exposing (Html)
|
||||
import Html.Attributes
|
||||
import Resources.ClearButton
|
||||
import Select exposing (Select)
|
||||
import Element.Region
|
||||
|
||||
main : Program () Model Msg
|
||||
main =
|
||||
@ -44,21 +43,13 @@ view model =
|
||||
, Element.padding 30
|
||||
]
|
||||
[ Select.view []
|
||||
{ onChange = CountrySelectMsg
|
||||
, label = Input.labelAbove [ Element.htmlAttribute <| Html.Attributes.for (Select.toInputElementId model.countrySelect) ] (Element.text "Choose a country")
|
||||
, placeholder = Just (Input.placeholder [] (Element.text "Type to search"))
|
||||
, itemToString = \c -> c.flag ++ " " ++ c.name
|
||||
}
|
||||
|> Select.withClearButton
|
||||
(Just
|
||||
(Select.clearButton [
|
||||
Element.alignRight
|
||||
, Element.centerY
|
||||
, Element.moveLeft 12 ]
|
||||
(Element.el [ Element.Region.description "clear selection" ] (Element.text "❌"))
|
||||
)
|
||||
)
|
||||
|> Select.toElement model.countrySelect
|
||||
{ onChange = CountrySelectMsg
|
||||
, label = Input.labelAbove [] (Element.text "Choose a country")
|
||||
, placeholder = Just (Input.placeholder [] (Element.text "Type to search"))
|
||||
, itemToString = \c -> c.flag ++ " " ++ c.name
|
||||
}
|
||||
|> Select.withClearButton (Just Resources.ClearButton.clearButton)
|
||||
|> Select.toElement model.countrySelect
|
||||
, Maybe.map (\{ name } -> Element.text ("You chose " ++ name)) (Select.toValue model.countrySelect)
|
||||
|> Maybe.withDefault Element.none
|
||||
]
|
||||
|
@ -10,7 +10,7 @@
|
||||
"examples": "cd examples/src && elm reactor"
|
||||
},
|
||||
"pre-commit": [
|
||||
"review"
|
||||
"ci"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
Loading…
Reference in New Issue
Block a user