mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-21 04:31:30 +03:00
lift eventsAndValues into internalConfig
This commit is contained in:
parent
647967d1b2
commit
2db0f5a6af
@ -289,7 +289,6 @@ view label attributes =
|
|||||||
type alias InternalConfig value msg =
|
type alias InternalConfig value msg =
|
||||||
{ -- user specified Attributes
|
{ -- user specified Attributes
|
||||||
name : String
|
name : String
|
||||||
, valueToString : value -> String
|
|
||||||
, label : String
|
, label : String
|
||||||
, teacherPremiumLevel : Maybe PremiumLevel
|
, teacherPremiumLevel : Maybe PremiumLevel
|
||||||
, contentPremiumLevel : Maybe PremiumLevel
|
, contentPremiumLevel : Maybe PremiumLevel
|
||||||
@ -297,8 +296,12 @@ type alias InternalConfig value msg =
|
|||||||
, describedByIds : List String
|
, describedByIds : List String
|
||||||
|
|
||||||
-- user specified messages and values TODO unpack eventsAndValues
|
-- user specified messages and values TODO unpack eventsAndValues
|
||||||
, eventsAndValues : EventsAndValues value msg
|
|
||||||
, value : value
|
, value : value
|
||||||
|
, selectedValue : Maybe value
|
||||||
|
, onSelect : Maybe (value -> msg)
|
||||||
|
, valueToString : value -> String
|
||||||
|
, premiumMsg : Maybe msg
|
||||||
|
, disclosedContent : List (Html msg)
|
||||||
|
|
||||||
-- computed values that both view helpers need
|
-- computed values that both view helpers need
|
||||||
, isChecked : Bool
|
, isChecked : Bool
|
||||||
@ -328,14 +331,17 @@ makeInternalConfig label config eventsAndValues =
|
|||||||
in
|
in
|
||||||
Just
|
Just
|
||||||
{ name = name_
|
{ name = name_
|
||||||
, valueToString = valueToString_
|
|
||||||
, label = label
|
, label = label
|
||||||
, teacherPremiumLevel = config.teacherPremiumLevel
|
, teacherPremiumLevel = config.teacherPremiumLevel
|
||||||
, contentPremiumLevel = config.contentPremiumLevel
|
, contentPremiumLevel = config.contentPremiumLevel
|
||||||
, isDisabled = config.isDisabled
|
, isDisabled = config.isDisabled
|
||||||
, describedByIds = config.describedByIds
|
, describedByIds = config.describedByIds
|
||||||
, eventsAndValues = eventsAndValues
|
|
||||||
, value = value_
|
, value = value_
|
||||||
|
, selectedValue = eventsAndValues.selectedValue
|
||||||
|
, onSelect = eventsAndValues.onSelect
|
||||||
|
, valueToString = valueToString_
|
||||||
|
, premiumMsg = eventsAndValues.premiumMsg
|
||||||
|
, disclosedContent = eventsAndValues.disclosedContent
|
||||||
, isChecked = isChecked
|
, isChecked = isChecked
|
||||||
, isLocked =
|
, isLocked =
|
||||||
case ( config.contentPremiumLevel, config.teacherPremiumLevel ) of
|
case ( config.contentPremiumLevel, config.teacherPremiumLevel ) of
|
||||||
@ -392,7 +398,7 @@ viewBlock internalConfig =
|
|||||||
internalConfig.isChecked
|
internalConfig.isChecked
|
||||||
[ id internalConfig.id
|
[ id internalConfig.id
|
||||||
, Widget.disabled (internalConfig.isLocked || internalConfig.isDisabled)
|
, Widget.disabled (internalConfig.isLocked || internalConfig.isDisabled)
|
||||||
, case ( internalConfig.eventsAndValues.onSelect, internalConfig.isDisabled ) of
|
, case ( internalConfig.onSelect, internalConfig.isDisabled ) of
|
||||||
( Just onSelect_, False ) ->
|
( Just onSelect_, False ) ->
|
||||||
onClick (onSelect_ internalConfig.value)
|
onClick (onSelect_ internalConfig.value)
|
||||||
|
|
||||||
@ -474,7 +480,7 @@ viewBlock internalConfig =
|
|||||||
, ClickableSvg.css [ marginLeft (px 8) ]
|
, ClickableSvg.css [ marginLeft (px 8) ]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
internalConfig.eventsAndValues.premiumMsg
|
internalConfig.premiumMsg
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, viewJust
|
, viewJust
|
||||||
@ -507,7 +513,7 @@ viewInline internalConfig =
|
|||||||
internalConfig.isChecked
|
internalConfig.isChecked
|
||||||
[ id internalConfig.id
|
[ id internalConfig.id
|
||||||
, Widget.disabled (internalConfig.isLocked || internalConfig.isDisabled)
|
, Widget.disabled (internalConfig.isLocked || internalConfig.isDisabled)
|
||||||
, case ( internalConfig.eventsAndValues.onSelect, internalConfig.isDisabled ) of
|
, case ( internalConfig.onSelect, internalConfig.isDisabled ) of
|
||||||
( Just onSelect_, False ) ->
|
( Just onSelect_, False ) ->
|
||||||
onClick (onSelect_ internalConfig.value)
|
onClick (onSelect_ internalConfig.value)
|
||||||
|
|
||||||
@ -593,7 +599,7 @@ viewInline internalConfig =
|
|||||||
, ClickableSvg.css [ marginLeft (px 8) ]
|
, ClickableSvg.css [ marginLeft (px 8) ]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
internalConfig.eventsAndValues.premiumMsg
|
internalConfig.premiumMsg
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
, viewJust
|
, viewJust
|
||||||
|
Loading…
Reference in New Issue
Block a user