always show Premium Pennant on Premium-content RadioButton

This commit is contained in:
Celso Bonutti 2022-03-10 10:35:40 -03:00
parent e77787f42f
commit 8a92d905a0

View File

@ -1,6 +1,6 @@
module Nri.Ui.RadioButton.V4 exposing module Nri.Ui.RadioButton.V4 exposing
( view ( view
, premium, showPennant , premium, onPennantClick
, disclosure , disclosure
, onSelect , onSelect
, Attribute , Attribute
@ -18,7 +18,7 @@ module Nri.Ui.RadioButton.V4 exposing
### Content ### Content
@docs premium, showPennant @docs premium, onPennantClick
@docs disclosure @docs disclosure
@ -110,13 +110,13 @@ premium premiumDisplay =
{ config | premiumDisplay = premiumDisplay } { config | premiumDisplay = premiumDisplay }
{-| Show Premium pennant on Premium content. {-| Makes the Premium pennant clickable.
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.
-} -}
showPennant : msg -> Attribute value msg onPennantClick : msg -> Attribute value msg
showPennant premiumMsg = onPennantClick premiumMsg =
Attribute <| \config -> { config | premiumMsg = Just premiumMsg } Attribute <| \config -> { config | premiumMsg = Just premiumMsg }
@ -408,10 +408,7 @@ view { label, name, value, valueToString, selectedValue } attributes =
( PremiumDisplay.Free, _ ) -> ( PremiumDisplay.Free, _ ) ->
text "" text ""
( _, Nothing ) -> ( _, premiumMsg ) ->
text ""
( _, Just premiumMsg ) ->
premiumPennant premiumMsg premiumPennant premiumMsg
] ]
] ]
@ -426,18 +423,27 @@ view { label, name, value, valueToString, selectedValue } attributes =
) )
premiumPennant : msg -> Html msg premiumPennant : Maybe msg -> Html msg
premiumPennant onClick = premiumPennant onClick =
ClickableSvg.button "Premium" let
Pennant.premiumFlag attrs =
[ ClickableSvg.onClick onClick [ ClickableSvg.exactWidth 26
, ClickableSvg.exactWidth 26
, ClickableSvg.exactHeight 24 , ClickableSvg.exactHeight 24
, ClickableSvg.css , ClickableSvg.css
[ marginLeft (px 8) [ marginLeft (px 8)
, verticalAlign middle , verticalAlign middle
] ]
] ]
in
ClickableSvg.button "Premium"
Pennant.premiumFlag
<|
case onClick of
Just msg ->
ClickableSvg.onClick msg :: attrs
Nothing ->
attrs
radioInputIcon : radioInputIcon :