Adds disabled and enabled helpers

This commit is contained in:
Tessa Kelly 2021-12-07 12:06:14 -08:00
parent e7a5aeed63
commit 2867c20e67
2 changed files with 21 additions and 12 deletions

View File

@ -2,6 +2,7 @@ module Nri.Ui.PremiumCheckbox.V7 exposing
( view ( view
, selected, partiallySelected , selected, partiallySelected
, premium, showPennant , premium, showPennant
, disabled, enabled
) )
{-| {-|
@ -20,6 +21,12 @@ module Nri.Ui.PremiumCheckbox.V7 exposing
@docs premium, showPennant @docs premium, showPennant
### Attributes
@docs Attribute
@docs disabled, enabled
-} -}
import Accessibility.Styled as Html exposing (Html) import Accessibility.Styled as Html exposing (Html)
@ -34,6 +41,20 @@ import String exposing (toLower)
import String.Extra exposing (dasherize) import String.Extra exposing (dasherize)
{-| This disables the input
-}
disabled : Attribute msg
disabled =
Attribute <| \config -> { config | isDisabled = True }
{-| This enables the input, this is the default behavior
-}
enabled : Attribute msg
enabled =
Attribute <| \config -> { config | isDisabled = False }
{-| Lock Premium content if the user does not have Premium. {-| Lock Premium content if the user does not have Premium.
-} -}
premium : premium :

View File

@ -185,10 +185,6 @@ viewPremiumCheckboxes state =
Html.div [] Html.div []
[ PremiumCheckbox.view [ PremiumCheckbox.view
{ label = "Identify Adjectives 1 (Premium)" { label = "Identify Adjectives 1 (Premium)"
--, disabled = False
--, isLocked = False
--, isPremium = True
, onChange = ToggleCheck "premium-1" , onChange = ToggleCheck "premium-1"
} }
[ PremiumCheckbox.premium [ PremiumCheckbox.premium
@ -200,10 +196,6 @@ viewPremiumCheckboxes state =
] ]
, PremiumCheckbox.view , PremiumCheckbox.view
{ label = "Identify Adjectives 2 (Free)" { label = "Identify Adjectives 2 (Free)"
--, disabled = False
--, isLocked = False
--, isPremium = False
, onChange = ToggleCheck "premium-2" , onChange = ToggleCheck "premium-2"
} }
[ PremiumCheckbox.premium [ PremiumCheckbox.premium
@ -215,10 +207,6 @@ viewPremiumCheckboxes state =
] ]
, PremiumCheckbox.view , PremiumCheckbox.view
{ label = "Revising Wordy Phrases 3 (Premium, Disabled)" { label = "Revising Wordy Phrases 3 (Premium, Disabled)"
--, disabled = True
--, isLocked = True
--, isPremium = True
, onChange = ToggleCheck "premium-3" , onChange = ToggleCheck "premium-3"
} }
[ PremiumCheckbox.premium [ PremiumCheckbox.premium