Automatically select new tiles
This commit is contained in:
parent
eab31cccc3
commit
22f713bf76
5
elm.json
5
elm.json
|
@ -12,9 +12,12 @@
|
|||
"elm/json": "1.1.3",
|
||||
"elm/svg": "1.0.1",
|
||||
"elm/url": "1.0.0",
|
||||
"elm-community/array-extra": "2.6.0"
|
||||
"elm-community/array-extra": "2.6.0",
|
||||
"elm-community/html-extra": "3.4.0",
|
||||
"elm-community/string-extra": "4.0.1"
|
||||
},
|
||||
"indirect": {
|
||||
"elm/regex": "1.0.0",
|
||||
"elm/time": "1.0.0",
|
||||
"elm/virtual-dom": "1.0.3"
|
||||
}
|
||||
|
|
|
@ -6,15 +6,17 @@ import Stickers exposing (Sticker, StickerContent(..), viewSticker)
|
|||
import Array exposing (Array, get, set)
|
||||
import Array.Extra as Array
|
||||
import Browser
|
||||
import Browser.Dom exposing (getViewport, Viewport)
|
||||
import Browser.Dom exposing (focus, getViewport, Viewport)
|
||||
import Browser.Navigation exposing (Key)
|
||||
import Browser.Events exposing (onResize)
|
||||
import Html exposing (button, div, h3, input, Html, section, text)
|
||||
import Html.Attributes exposing (class, style, value)
|
||||
import Html.Attributes exposing (class, id, style, value)
|
||||
import Html.Attributes.Extra exposing (attributeIf)
|
||||
import Html.Events exposing (onBlur, onClick, onInput)
|
||||
import Json.Decode as D
|
||||
import List exposing (map, singleton)
|
||||
import String exposing (fromInt, isEmpty)
|
||||
import String.Extra exposing (isBlank)
|
||||
import Svg exposing (Svg, svg)
|
||||
import Svg.Attributes exposing (height, viewBox, width)
|
||||
import Svg.Events exposing (on)
|
||||
|
@ -126,6 +128,7 @@ viewTile columnIndex tileIndex tile =
|
|||
[ value tile.text
|
||||
, onInput (SetTileText columnIndex tileIndex)
|
||||
, onBlur (TileDeselected columnIndex)
|
||||
, attributeIf (isBlank tile.text) (id "new-tile")
|
||||
]
|
||||
[]
|
||||
, svg
|
||||
|
@ -203,7 +206,7 @@ update msg model = case Debug.log "UPDATE" msg of
|
|||
modColumnInPage columnIndex
|
||||
addTileToColumn
|
||||
model
|
||||
|> withoutCmd
|
||||
|> withCmd (Task.attempt (constant Noop) (focus "new-tile"))
|
||||
TileDeselected columnIndex ->
|
||||
modColumnInPage columnIndex
|
||||
pruneTiles
|
||||
|
|
Loading…
Reference in New Issue