mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-04 07:02:12 +03:00
Run elm review
This commit is contained in:
parent
790a802ff5
commit
cb487851e5
@ -9,26 +9,27 @@
|
|||||||
"elm/core": "1.0.5",
|
"elm/core": "1.0.5",
|
||||||
"elm/json": "1.1.3",
|
"elm/json": "1.1.3",
|
||||||
"elm/project-metadata-utils": "1.0.2",
|
"elm/project-metadata-utils": "1.0.2",
|
||||||
"jfmengels/elm-review": "2.7.0",
|
"jfmengels/elm-review": "2.12.2",
|
||||||
"jfmengels/elm-review-unused": "1.1.20",
|
"jfmengels/elm-review-unused": "1.1.29",
|
||||||
"stil4m/elm-syntax": "7.2.9"
|
"stil4m/elm-syntax": "7.2.9"
|
||||||
},
|
},
|
||||||
"indirect": {
|
"indirect": {
|
||||||
|
"elm/bytes": "1.0.8",
|
||||||
"elm/html": "1.0.0",
|
"elm/html": "1.0.0",
|
||||||
"elm/parser": "1.1.0",
|
"elm/parser": "1.1.0",
|
||||||
"elm/random": "1.0.0",
|
"elm/random": "1.0.0",
|
||||||
"elm/time": "1.0.0",
|
"elm/time": "1.0.0",
|
||||||
"elm/virtual-dom": "1.0.2",
|
"elm/virtual-dom": "1.0.3",
|
||||||
"elm-community/list-extra": "8.5.2",
|
"elm-community/list-extra": "8.7.0",
|
||||||
"elm-explorations/test": "1.2.2",
|
"elm-explorations/test": "2.1.1",
|
||||||
"miniBill/elm-unicode": "1.0.2",
|
"miniBill/elm-unicode": "1.0.3",
|
||||||
"rtfeldman/elm-hex": "1.0.0",
|
"rtfeldman/elm-hex": "1.0.0",
|
||||||
"stil4m/structured-writer": "1.0.3"
|
"stil4m/structured-writer": "1.0.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test-dependencies": {
|
"test-dependencies": {
|
||||||
"direct": {
|
"direct": {
|
||||||
"elm-explorations/test": "1.2.2"
|
"elm-explorations/test": "2.1.1"
|
||||||
},
|
},
|
||||||
"indirect": {}
|
"indirect": {}
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,10 @@ module Nri.Ui.HighlighterToolbar.V3 exposing (view)
|
|||||||
-}
|
-}
|
||||||
|
|
||||||
import Accessibility.Styled.Aria as Aria
|
import Accessibility.Styled.Aria as Aria
|
||||||
import Accessibility.Styled.Key as Key
|
|
||||||
import Accessibility.Styled.Role as Role
|
import Accessibility.Styled.Role as Role
|
||||||
import Css exposing (Color)
|
import Css exposing (Color)
|
||||||
import EventExtras exposing (onClickPreventDefaultAndStopPropagation)
|
|
||||||
import Html.Styled exposing (..)
|
import Html.Styled exposing (..)
|
||||||
import Html.Styled.Attributes as Attributes exposing (css, id, tabindex)
|
import Html.Styled.Attributes as Attributes exposing (css, id)
|
||||||
import Html.Styled.Events exposing (onClick)
|
import Html.Styled.Events exposing (onClick)
|
||||||
import Nri.Ui.Colors.V1 as Colors
|
import Nri.Ui.Colors.V1 as Colors
|
||||||
import Nri.Ui.FocusRing.V1 as FocusRing
|
import Nri.Ui.FocusRing.V1 as FocusRing
|
||||||
@ -162,54 +160,6 @@ viewTool name focusAndSelect theme selected tag tools currentTool getName =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
keyEvents : ({ select : Maybe tag, focus : Maybe String } -> msg) -> Maybe tag -> List (Maybe tag) -> (tag -> String) -> List (Key.Event msg)
|
|
||||||
keyEvents focusAndSelect tag tools getName =
|
|
||||||
let
|
|
||||||
onFocus tag_ =
|
|
||||||
focusAndSelect
|
|
||||||
{ select = tag_
|
|
||||||
, focus =
|
|
||||||
case tag_ of
|
|
||||||
Just tag__ ->
|
|
||||||
Just ("tag-" ++ getName tag__)
|
|
||||||
|
|
||||||
Nothing ->
|
|
||||||
Just "tag-Remove highlight"
|
|
||||||
}
|
|
||||||
|
|
||||||
findAdjacentTag tag_ ( isAdjacentTab, acc ) =
|
|
||||||
if isAdjacentTab then
|
|
||||||
( False, Just (onFocus tag_) )
|
|
||||||
|
|
||||||
else
|
|
||||||
( tag_ == tag, acc )
|
|
||||||
|
|
||||||
goToNextTag : Maybe msg
|
|
||||||
goToNextTag =
|
|
||||||
List.foldl findAdjacentTag
|
|
||||||
( False
|
|
||||||
, -- if there is no adjacent tag, default to the first tag
|
|
||||||
Maybe.map onFocus (List.head tools)
|
|
||||||
)
|
|
||||||
tools
|
|
||||||
|> Tuple.second
|
|
||||||
|
|
||||||
goToPreviousTag : Maybe msg
|
|
||||||
goToPreviousTag =
|
|
||||||
List.foldr findAdjacentTag
|
|
||||||
( False
|
|
||||||
, -- if there is no adjacent tag, default to the last tag
|
|
||||||
Maybe.map onFocus (List.head (List.reverse tools))
|
|
||||||
)
|
|
||||||
tools
|
|
||||||
|> Tuple.second
|
|
||||||
in
|
|
||||||
List.filterMap identity
|
|
||||||
[ Maybe.map Key.right goToNextTag
|
|
||||||
, Maybe.map Key.left goToPreviousTag
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
active :
|
active :
|
||||||
{ extras | colorLight : Color }
|
{ extras | colorLight : Color }
|
||||||
-> Html msg
|
-> Html msg
|
||||||
|
Loading…
Reference in New Issue
Block a user