mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-20 04:01:40 +03:00
Adds disabled attribute example
This commit is contained in:
parent
a52c6c785f
commit
34cd3894a5
@ -3,7 +3,7 @@ module Nri.Ui.Switch.V2 exposing
|
|||||||
, Attribute
|
, Attribute
|
||||||
, selected
|
, selected
|
||||||
, containerCss, labelCss, custom, nriDescription, testId
|
, containerCss, labelCss, custom, nriDescription, testId
|
||||||
, onSwitch, disabled, enabled
|
, onSwitch, disabled
|
||||||
)
|
)
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
@ -18,6 +18,7 @@ module Nri.Ui.Switch.V2 exposing
|
|||||||
- Move the status (selected or not selected) to the list api
|
- Move the status (selected or not selected) to the list api
|
||||||
- REQUIRE label and id always
|
- REQUIRE label and id always
|
||||||
- Move custom attributes to the container
|
- Move custom attributes to the container
|
||||||
|
- change disabled to take a bool (which I think is the slighty more common pattern)
|
||||||
|
|
||||||
@docs view
|
@docs view
|
||||||
|
|
||||||
@ -27,7 +28,7 @@ module Nri.Ui.Switch.V2 exposing
|
|||||||
@docs Attribute
|
@docs Attribute
|
||||||
@docs selected
|
@docs selected
|
||||||
@docs containerCss, labelCss, custom, nriDescription, testId
|
@docs containerCss, labelCss, custom, nriDescription, testId
|
||||||
@docs onSwitch, disabled, enabled
|
@docs onSwitch, disabled
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
@ -70,15 +71,9 @@ onSwitch onSwitch_ =
|
|||||||
specify `onSwitch`, this is the default, but it's provided so you don't have
|
specify `onSwitch`, this is the default, but it's provided so you don't have
|
||||||
to resort to `filterMap` or similar to build a clean list of attributes.
|
to resort to `filterMap` or similar to build a clean list of attributes.
|
||||||
-}
|
-}
|
||||||
disabled : Attribute msg
|
disabled : Bool -> Attribute msg
|
||||||
disabled =
|
disabled isDisabled =
|
||||||
Attribute <| \config -> { config | isDisabled = True }
|
Attribute <| \config -> { config | isDisabled = isDisabled }
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
|
||||||
enabled : Attribute msg
|
|
||||||
enabled =
|
|
||||||
Attribute <| \config -> { config | isDisabled = False }
|
|
||||||
|
|
||||||
|
|
||||||
{-| Pass custom attributes through to be attached to the underlying input.
|
{-| Pass custom attributes through to be attached to the underlying input.
|
||||||
|
@ -8,6 +8,7 @@ module Examples.Switch exposing (Msg, State, example)
|
|||||||
|
|
||||||
import Accessibility.Styled.Key as Key
|
import Accessibility.Styled.Key as Key
|
||||||
import Category
|
import Category
|
||||||
|
import CommonControls
|
||||||
import Debug.Control as Control exposing (Control)
|
import Debug.Control as Control exposing (Control)
|
||||||
import Debug.Control.Extra as ControlExtra
|
import Debug.Control.Extra as ControlExtra
|
||||||
import Debug.Control.View as ControlView
|
import Debug.Control.View as ControlView
|
||||||
@ -122,6 +123,7 @@ controlSettings =
|
|||||||
initAttributes : Control (List ( String, Switch.Attribute msg ))
|
initAttributes : Control (List ( String, Switch.Attribute msg ))
|
||||||
initAttributes =
|
initAttributes =
|
||||||
ControlExtra.list
|
ControlExtra.list
|
||||||
|
|> CommonControls.disabledListItem moduleName Switch.disabled
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
|
Loading…
Reference in New Issue
Block a user