mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-13 18:43:19 +03:00
🎨 explore internal api -- what bits of the model are we actually using
This commit is contained in:
parent
5eff08304a
commit
e6a474a3d6
@ -119,39 +119,38 @@ buildCheckbox model labelContent =
|
|||||||
viewCheckbox model <|
|
viewCheckbox model <|
|
||||||
case model.theme of
|
case model.theme of
|
||||||
Square ->
|
Square ->
|
||||||
let
|
|
||||||
squareIcon =
|
|
||||||
case model.selected of
|
|
||||||
Selected ->
|
|
||||||
checkboxChecked
|
|
||||||
|
|
||||||
NotSelected ->
|
|
||||||
checkboxUnchecked
|
|
||||||
|
|
||||||
PartiallySelected ->
|
|
||||||
checkboxCheckedPartially
|
|
||||||
in
|
|
||||||
{ containerClasses = toClassList [ "SquareClass" ]
|
{ containerClasses = toClassList [ "SquareClass" ]
|
||||||
, labelStyles =
|
, labelStyles =
|
||||||
if model.disabled then
|
if model.disabled then
|
||||||
disabledSquareLabel squareIcon
|
disabledSquareLabel
|
||||||
|
|
||||||
else
|
else
|
||||||
enabledSquareLabel squareIcon
|
enabledSquareLabel
|
||||||
, labelClasses = labelClass model.selected
|
, labelClasses = labelClass model.selected
|
||||||
, labelContent = labelContent
|
, labelContent = labelContent
|
||||||
|
, icon =
|
||||||
|
case model.selected of
|
||||||
|
Selected ->
|
||||||
|
checkboxChecked
|
||||||
|
|
||||||
|
NotSelected ->
|
||||||
|
checkboxUnchecked
|
||||||
|
|
||||||
|
PartiallySelected ->
|
||||||
|
checkboxCheckedPartially
|
||||||
}
|
}
|
||||||
|
|
||||||
Locked ->
|
Locked ->
|
||||||
{ containerClasses = toClassList [ "Locked" ]
|
{ containerClasses = toClassList [ "Locked" ]
|
||||||
, labelStyles =
|
, labelStyles =
|
||||||
if model.disabled then
|
if model.disabled then
|
||||||
disabledLockStyles checkboxLockOnInside
|
disabledLockStyles
|
||||||
|
|
||||||
else
|
else
|
||||||
enabledLockLabelStyles checkboxLockOnInside
|
enabledLockLabelStyles
|
||||||
, labelClasses = labelClass model.selected
|
, labelClasses = labelClass model.selected
|
||||||
, labelContent = labelContent
|
, labelContent = labelContent
|
||||||
|
, icon = checkboxLockOnInside
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -257,12 +256,19 @@ toClassList =
|
|||||||
|
|
||||||
|
|
||||||
viewCheckbox :
|
viewCheckbox :
|
||||||
Model msg
|
{ a
|
||||||
|
| identifier : String
|
||||||
|
, label : String
|
||||||
|
, setterMsg : Bool -> msg
|
||||||
|
, selected : IsSelected
|
||||||
|
, disabled : Bool
|
||||||
|
}
|
||||||
->
|
->
|
||||||
{ containerClasses : Html.Attribute msg
|
{ containerClasses : Html.Attribute msg
|
||||||
, labelStyles : List Style
|
, labelStyles : Icon -> List Style
|
||||||
, labelClasses : Html.Attribute msg
|
, labelClasses : Html.Attribute msg
|
||||||
, labelContent : Html.Html msg
|
, labelContent : Html.Html msg
|
||||||
|
, icon : Icon
|
||||||
}
|
}
|
||||||
-> Html.Html msg
|
-> Html.Html msg
|
||||||
viewCheckbox model config =
|
viewCheckbox model config =
|
||||||
@ -290,11 +296,21 @@ viewCheckbox model config =
|
|||||||
, Attributes.id model.identifier
|
, Attributes.id model.identifier
|
||||||
, Attributes.disabled model.disabled
|
, Attributes.disabled model.disabled
|
||||||
]
|
]
|
||||||
, viewLabel model config.labelContent config.labelClasses config.labelStyles
|
, viewLabel model config.labelContent config.labelClasses (config.labelStyles config.icon)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
viewLabel : Model msg -> Html.Html msg -> Html.Attribute msg -> List Style -> Html.Html msg
|
viewLabel :
|
||||||
|
{ a
|
||||||
|
| identifier : String
|
||||||
|
, setterMsg : Bool -> msg
|
||||||
|
, selected : IsSelected
|
||||||
|
, disabled : Bool
|
||||||
|
}
|
||||||
|
-> Html.Html msg
|
||||||
|
-> Html.Attribute msg
|
||||||
|
-> List Style
|
||||||
|
-> Html.Html msg
|
||||||
viewLabel model content class theme =
|
viewLabel model content class theme =
|
||||||
Html.Styled.label
|
Html.Styled.label
|
||||||
[ Attributes.for model.identifier
|
[ Attributes.for model.identifier
|
||||||
|
Loading…
Reference in New Issue
Block a user