RadioButton: Rename onLockedPennantClick to onLockedClick

This commit is contained in:
Brian J. Cardiff 2022-03-11 14:54:58 -03:00
parent b2853e62f0
commit 809d7e463a
2 changed files with 16 additions and 16 deletions

View File

@ -1,6 +1,6 @@
module Nri.Ui.RadioButton.V4 exposing module Nri.Ui.RadioButton.V4 exposing
( view ( view
, premium, onLockedPennantClick , premium, onLockedClick
, disclosure , disclosure
, onSelect , onSelect
, Attribute , Attribute
@ -12,14 +12,14 @@ module Nri.Ui.RadioButton.V4 exposing
{-| Changes from V3: {-| Changes from V3:
- use PremiumDisplay instead of PremiumLevel - 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 @docs view
### Content ### Content
@docs premium, onLockedPennantClick @docs premium, onLockedClick
@docs disclosure @docs disclosure
@ -116,9 +116,9 @@ premium premiumDisplay =
When the pennant is clicked, the msg that's passed in will fire. When the pennant is clicked, the msg that's passed in will fire.
-} -}
onLockedPennantClick : msg -> Attribute value msg onLockedClick : msg -> Attribute value msg
onLockedPennantClick premiumMsg = onLockedClick onLockedMsg =
Attribute <| \config -> { config | premiumMsg = Just premiumMsg } Attribute <| \config -> { config | onLockedMsg = Just onLockedMsg }
{-| Content that shows when this RadioButton is selected {-| Content that shows when this RadioButton is selected
@ -213,7 +213,7 @@ type alias Config value msg =
, labelCss : List Css.Style , labelCss : List Css.Style
, custom : List (Html.Attribute Never) , custom : List (Html.Attribute Never)
, onSelect : Maybe (value -> msg) , onSelect : Maybe (value -> msg)
, premiumMsg : Maybe msg , onLockedMsg : Maybe msg
, disclosedContent : List (Html msg) , disclosedContent : List (Html msg)
} }
@ -231,7 +231,7 @@ emptyConfig =
, labelCss = [] , labelCss = []
, custom = [] , custom = []
, onSelect = Nothing , onSelect = Nothing
, premiumMsg = Nothing , onLockedMsg = Nothing
, disclosedContent = [] , disclosedContent = []
} }
@ -405,15 +405,15 @@ view { label, name, value, valueToString, selectedValue } attributes =
config.labelCss config.labelCss
] ]
[ Html.text label ] [ Html.text label ]
, case ( config.premiumDisplay, config.premiumMsg ) of , case ( config.premiumDisplay, config.onLockedMsg ) of
( PremiumDisplay.Free, _ ) -> ( PremiumDisplay.Free, _ ) ->
text "" text ""
( PremiumDisplay.PremiumUnlocked, _ ) -> ( PremiumDisplay.PremiumUnlocked, _ ) ->
premiumPennant Nothing premiumPennant Nothing
( PremiumDisplay.PremiumLocked, premiumMsg ) -> ( PremiumDisplay.PremiumLocked, onLockedMsg ) ->
premiumPennant premiumMsg premiumPennant onLockedMsg
] ]
] ]
, InputErrorAndGuidanceInternal.view idValue config , InputErrorAndGuidanceInternal.view idValue config

View File

@ -239,7 +239,7 @@ controlAttributes =
ControlExtra.list ControlExtra.list
|> ControlExtra.optionalListItem "visibility" labelVisibility |> ControlExtra.optionalListItem "visibility" labelVisibility
|> ControlExtra.optionalListItem "status" disabledOrEnabled |> ControlExtra.optionalListItem "status" disabledOrEnabled
|> ControlExtra.optionalListItem "onLockedPennantClick" onLockedPennantClick |> ControlExtra.optionalListItem "onLockedClick" onLockedClick
|> ControlExtra.optionalListItem "premium" |> ControlExtra.optionalListItem "premium"
-- TODO: allow the teacher premium level to vary as well: -- TODO: allow the teacher premium level to vary as well:
(Control.map (Control.map
@ -329,11 +329,11 @@ disabledOrEnabled =
] ]
onLockedPennantClick : Control ( String, RadioButton.Attribute Selection Msg ) onLockedClick : Control ( String, RadioButton.Attribute Selection Msg )
onLockedPennantClick = onLockedClick =
Control.value Control.value
( "RadioButton.onLockedPennantClick OpenPremiumModal" ( "RadioButton.onLockedClick OpenPremiumModal"
, RadioButton.onLockedPennantClick (OpenModal "dogs") , RadioButton.onLockedClick (OpenModal "dogs")
) )