mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-04 17:24:06 +03:00
Remove the noOp
This commit is contained in:
parent
858b1fd758
commit
c2e1257895
@ -43,7 +43,6 @@ view :
|
||||
, selectedValue : Maybe a
|
||||
, onSelect : a -> msg
|
||||
, showLabel : Bool
|
||||
, noOpMsg : msg
|
||||
, valueToString : a -> String
|
||||
}
|
||||
-> Html msg
|
||||
@ -57,8 +56,7 @@ view config =
|
||||
, isLocked = False
|
||||
, isDisabled = False
|
||||
, onSelect = config.onSelect
|
||||
, premiumMsg = config.noOpMsg
|
||||
, noOpMsg = config.noOpMsg
|
||||
, premiumMsg = Nothing
|
||||
, valueToString = config.valueToString
|
||||
, showPennant = False
|
||||
}
|
||||
@ -83,7 +81,6 @@ premium :
|
||||
, contentPremiumLevel : PremiumLevel
|
||||
, onSelect : a -> msg
|
||||
, premiumMsg : msg
|
||||
, noOpMsg : msg
|
||||
, valueToString : a -> String
|
||||
, showPennant : Bool
|
||||
, isDisabled : Bool
|
||||
@ -107,8 +104,7 @@ premium config =
|
||||
, onSelect = config.onSelect
|
||||
, showLabel = True
|
||||
, valueToString = config.valueToString
|
||||
, premiumMsg = config.premiumMsg
|
||||
, noOpMsg = config.noOpMsg
|
||||
, premiumMsg = Just config.premiumMsg
|
||||
, showPennant =
|
||||
case config.contentPremiumLevel of
|
||||
PremiumLevel.Premium ->
|
||||
@ -131,8 +127,7 @@ type alias InternalConfig a msg =
|
||||
, isDisabled : Bool
|
||||
, onSelect : a -> msg
|
||||
, showLabel : Bool
|
||||
, premiumMsg : msg
|
||||
, noOpMsg : msg
|
||||
, premiumMsg : Maybe msg
|
||||
, valueToString : a -> String
|
||||
, showPennant : Bool
|
||||
}
|
||||
@ -146,13 +141,6 @@ internalView config =
|
||||
|
||||
id_ =
|
||||
config.name ++ "-" ++ dasherize (toLower (config.valueToString config.value))
|
||||
|
||||
onContainerClick =
|
||||
if config.isLocked then
|
||||
config.premiumMsg
|
||||
|
||||
else
|
||||
config.noOpMsg
|
||||
in
|
||||
Html.span
|
||||
[ id (id_ ++ "-container")
|
||||
@ -244,7 +232,8 @@ internalView config =
|
||||
(\() ->
|
||||
ClickableSvg.button "Premium"
|
||||
Pennant.premiumFlag
|
||||
[ ClickableSvg.onClick config.premiumMsg
|
||||
[ Maybe.map ClickableSvg.onClick config.premiumMsg
|
||||
|> Maybe.withDefault (ClickableSvg.custom [])
|
||||
, ClickableSvg.exactWidth 26
|
||||
, ClickableSvg.exactHeight 24
|
||||
, ClickableSvg.css [ marginLeft (px 8) ]
|
||||
|
@ -23,7 +23,7 @@ import Nri.Ui.Button.V10 as Button
|
||||
import Nri.Ui.Data.PremiumLevel as PremiumLevel exposing (PremiumLevel)
|
||||
import Nri.Ui.Heading.V2 as Heading
|
||||
import Nri.Ui.Modal.V10 as Modal
|
||||
import Nri.Ui.RadioButton.V1 as RadioButton
|
||||
import Nri.Ui.RadioButton.V2 as RadioButton
|
||||
import Nri.Ui.Text.V5 as Text
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ import Nri.Ui.Text.V5 as Text
|
||||
example : Example State Msg
|
||||
example =
|
||||
{ name = "RadioButton"
|
||||
, version = 1
|
||||
, version = 2
|
||||
, state = init
|
||||
, update = update
|
||||
, subscriptions = subscriptions
|
||||
@ -39,8 +39,16 @@ example =
|
||||
, categories = [ Layout ]
|
||||
, atomicDesignType = Atom
|
||||
, keyboardSupport =
|
||||
-- TODO: fix keyboard support.
|
||||
[]
|
||||
[ { keys = [ Arrow KeyboardSupport.Left ]
|
||||
, result = "Move the focus & select the radio button to the left"
|
||||
}
|
||||
, { keys = [ Arrow KeyboardSupport.Right ]
|
||||
, result = "Move the focus & select the radio button to the right"
|
||||
}
|
||||
, { keys = [ Arrow KeyboardSupport.Space ]
|
||||
, result = "Select the current radio button"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +96,6 @@ viewVanilla state =
|
||||
, name = "radio-button-examples"
|
||||
, selectedValue = state.selectedValue
|
||||
, onSelect = Select
|
||||
, noOpMsg = NoOp
|
||||
, valueToString = identity
|
||||
}
|
||||
, RadioButton.view
|
||||
@ -98,7 +105,6 @@ viewVanilla state =
|
||||
, name = "radio-button-examples"
|
||||
, selectedValue = state.selectedValue
|
||||
, onSelect = Select
|
||||
, noOpMsg = NoOp
|
||||
, valueToString = identity
|
||||
}
|
||||
]
|
||||
@ -115,7 +121,6 @@ viewInvisibleLabel state =
|
||||
, name = "Secret"
|
||||
, selectedValue = state.selectedValue
|
||||
, onSelect = Select
|
||||
, noOpMsg = NoOp
|
||||
, valueToString = \_ -> "i-m-a-secret-but-not-to-screen-readers"
|
||||
}
|
||||
]
|
||||
@ -149,7 +154,6 @@ viewPremium state =
|
||||
-- and use the correct id, there's not much point in doing
|
||||
-- so yet since the radio doesn't handle focus correctly.
|
||||
, premiumMsg = ModalMsg (Modal.open "fake-id")
|
||||
, noOpMsg = NoOp
|
||||
, valueToString = identity
|
||||
, showPennant = premiumConfig.showPennant
|
||||
, isDisabled = False
|
||||
@ -170,7 +174,6 @@ viewPremium state =
|
||||
-- and use the correct id, there's not much point in doing
|
||||
-- so yet since the radio doesn't handle focus correctly.
|
||||
, premiumMsg = ModalMsg (Modal.open "fake-id")
|
||||
, noOpMsg = NoOp
|
||||
, valueToString = identity
|
||||
, showPennant = premiumConfig.showPennant
|
||||
, isDisabled = False
|
||||
@ -191,7 +194,6 @@ viewPremium state =
|
||||
-- and use the correct id, there's not much point in doing
|
||||
-- so yet since the radio doesn't handle focus correctly.
|
||||
, premiumMsg = ModalMsg (Modal.open "fake-id")
|
||||
, noOpMsg = NoOp
|
||||
, valueToString = identity
|
||||
, showPennant = premiumConfig.showPennant
|
||||
, isDisabled = True
|
||||
|
Loading…
Reference in New Issue
Block a user