mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-18 19:21:29 +03:00
RadioButton: Rename onLockedPennantClick to onLockedClick
This commit is contained in:
parent
b2853e62f0
commit
809d7e463a
@ -1,6 +1,6 @@
|
||||
module Nri.Ui.RadioButton.V4 exposing
|
||||
( view
|
||||
, premium, onLockedPennantClick
|
||||
, premium, onLockedClick
|
||||
, disclosure
|
||||
, onSelect
|
||||
, Attribute
|
||||
@ -12,14 +12,14 @@ module Nri.Ui.RadioButton.V4 exposing
|
||||
{-| Changes from V3:
|
||||
|
||||
- use PremiumDisplay instead of PremiumLevel
|
||||
- rename showPennant to onLockedPennantClick since its display depends on premium now
|
||||
- rename showPennant to onLockedClick since its display depends on premium now
|
||||
|
||||
@docs view
|
||||
|
||||
|
||||
### Content
|
||||
|
||||
@docs premium, onLockedPennantClick
|
||||
@docs premium, onLockedClick
|
||||
@docs disclosure
|
||||
|
||||
|
||||
@ -116,9 +116,9 @@ premium premiumDisplay =
|
||||
When the pennant is clicked, the msg that's passed in will fire.
|
||||
|
||||
-}
|
||||
onLockedPennantClick : msg -> Attribute value msg
|
||||
onLockedPennantClick premiumMsg =
|
||||
Attribute <| \config -> { config | premiumMsg = Just premiumMsg }
|
||||
onLockedClick : msg -> Attribute value msg
|
||||
onLockedClick onLockedMsg =
|
||||
Attribute <| \config -> { config | onLockedMsg = Just onLockedMsg }
|
||||
|
||||
|
||||
{-| Content that shows when this RadioButton is selected
|
||||
@ -213,7 +213,7 @@ type alias Config value msg =
|
||||
, labelCss : List Css.Style
|
||||
, custom : List (Html.Attribute Never)
|
||||
, onSelect : Maybe (value -> msg)
|
||||
, premiumMsg : Maybe msg
|
||||
, onLockedMsg : Maybe msg
|
||||
, disclosedContent : List (Html msg)
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ emptyConfig =
|
||||
, labelCss = []
|
||||
, custom = []
|
||||
, onSelect = Nothing
|
||||
, premiumMsg = Nothing
|
||||
, onLockedMsg = Nothing
|
||||
, disclosedContent = []
|
||||
}
|
||||
|
||||
@ -405,15 +405,15 @@ view { label, name, value, valueToString, selectedValue } attributes =
|
||||
config.labelCss
|
||||
]
|
||||
[ Html.text label ]
|
||||
, case ( config.premiumDisplay, config.premiumMsg ) of
|
||||
, case ( config.premiumDisplay, config.onLockedMsg ) of
|
||||
( PremiumDisplay.Free, _ ) ->
|
||||
text ""
|
||||
|
||||
( PremiumDisplay.PremiumUnlocked, _ ) ->
|
||||
premiumPennant Nothing
|
||||
|
||||
( PremiumDisplay.PremiumLocked, premiumMsg ) ->
|
||||
premiumPennant premiumMsg
|
||||
( PremiumDisplay.PremiumLocked, onLockedMsg ) ->
|
||||
premiumPennant onLockedMsg
|
||||
]
|
||||
]
|
||||
, InputErrorAndGuidanceInternal.view idValue config
|
||||
|
@ -239,7 +239,7 @@ controlAttributes =
|
||||
ControlExtra.list
|
||||
|> ControlExtra.optionalListItem "visibility" labelVisibility
|
||||
|> ControlExtra.optionalListItem "status" disabledOrEnabled
|
||||
|> ControlExtra.optionalListItem "onLockedPennantClick" onLockedPennantClick
|
||||
|> ControlExtra.optionalListItem "onLockedClick" onLockedClick
|
||||
|> ControlExtra.optionalListItem "premium"
|
||||
-- TODO: allow the teacher premium level to vary as well:
|
||||
(Control.map
|
||||
@ -329,11 +329,11 @@ disabledOrEnabled =
|
||||
]
|
||||
|
||||
|
||||
onLockedPennantClick : Control ( String, RadioButton.Attribute Selection Msg )
|
||||
onLockedPennantClick =
|
||||
onLockedClick : Control ( String, RadioButton.Attribute Selection Msg )
|
||||
onLockedClick =
|
||||
Control.value
|
||||
( "RadioButton.onLockedPennantClick OpenPremiumModal"
|
||||
, RadioButton.onLockedPennantClick (OpenModal "dogs")
|
||||
( "RadioButton.onLockedClick OpenPremiumModal"
|
||||
, RadioButton.onLockedClick (OpenModal "dogs")
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user