mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-29 02:42:23 +03:00
🎨 move toward forking a little bit higher in advance of moving the styles
This commit is contained in:
parent
3248a71007
commit
6f7be4edc0
@ -264,20 +264,21 @@ buildCheckbox modifierClasses showLabels model =
|
|||||||
, RootAttributes.id model.identifier
|
, RootAttributes.id model.identifier
|
||||||
, RootAttributes.disabled model.disabled
|
, RootAttributes.disabled model.disabled
|
||||||
]
|
]
|
||||||
, Html.span
|
, if showLabels then
|
||||||
(if showLabels then
|
viewLabel model
|
||||||
[]
|
(Html.span [] [ Html.text model.label ])
|
||||||
else
|
(labelClassAndTheme model.isChecked)
|
||||||
[ Accessibility.Styled.Style.invisible ]
|
|> toUnstyled
|
||||||
)
|
else
|
||||||
[ Html.text model.label ]
|
viewLabel model
|
||||||
|> viewLabel model
|
(Html.span [ Accessibility.Styled.Style.invisible ] [ Html.text model.label ])
|
||||||
|> toUnstyled
|
(labelClassAndTheme model.isChecked)
|
||||||
|
|> toUnstyled
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
viewLabel : Model msg -> Html.Html msg -> Html.Html msg
|
viewLabel : Model msg -> Html.Html msg -> ( Html.Attribute msg, Html.Attribute msg ) -> Html.Html msg
|
||||||
viewLabel model content =
|
viewLabel model content ( class, theme ) =
|
||||||
Html.Styled.label
|
Html.Styled.label
|
||||||
[ Attributes.for model.identifier
|
[ Attributes.for model.identifier
|
||||||
, Aria.controls model.identifier
|
, Aria.controls model.identifier
|
||||||
@ -300,38 +301,73 @@ viewLabel model content =
|
|||||||
)
|
)
|
||||||
else
|
else
|
||||||
ExtraAttributes.none
|
ExtraAttributes.none
|
||||||
, labelClass model.isChecked
|
, class
|
||||||
, css
|
, theme
|
||||||
[ cursor pointer
|
|
||||||
, outline none
|
|
||||||
|
|
||||||
--TODO These styles depend on the theme
|
|
||||||
--, case maybeChecked of
|
|
||||||
-- Just True ->
|
|
||||||
-- Checked
|
|
||||||
-- Just False ->
|
|
||||||
-- Unchecked
|
|
||||||
-- Nothing ->
|
|
||||||
-- Indeterminate
|
|
||||||
]
|
|
||||||
]
|
]
|
||||||
[ content ]
|
[ content ]
|
||||||
|
|
||||||
|
|
||||||
labelClass : Maybe Bool -> Html.Attribute msg
|
labelClassAndTheme isChecked =
|
||||||
labelClass maybeChecked =
|
case isChecked of
|
||||||
Attributes.classList
|
Just True ->
|
||||||
[ ( "checkbox-Label", True )
|
( Attributes.classList
|
||||||
, case maybeChecked of
|
[ ( "checkbox-Label", True )
|
||||||
Just True ->
|
, ( "checkbox-Checked", True )
|
||||||
( "checkbox-Checked", True )
|
]
|
||||||
|
, css
|
||||||
|
[ cursor pointer
|
||||||
|
, outline none
|
||||||
|
|
||||||
Just False ->
|
--TODO These styles depend on the theme
|
||||||
( "checkbox-Unchecked", True )
|
--, case maybeChecked of
|
||||||
|
-- Just True ->
|
||||||
|
-- Checked
|
||||||
|
-- Just False ->
|
||||||
|
-- Unchecked
|
||||||
|
-- Nothing ->
|
||||||
|
-- Indeterminate
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
Nothing ->
|
Just False ->
|
||||||
( "checkbox-Indeterminate", True )
|
( Attributes.classList
|
||||||
]
|
[ ( "checkbox-Label", True )
|
||||||
|
, ( "checkbox-Unchecked", True )
|
||||||
|
]
|
||||||
|
, css
|
||||||
|
[ cursor pointer
|
||||||
|
, outline none
|
||||||
|
|
||||||
|
--TODO These styles depend on the theme
|
||||||
|
--, case maybeChecked of
|
||||||
|
-- Just True ->
|
||||||
|
-- Checked
|
||||||
|
-- Just False ->
|
||||||
|
-- Unchecked
|
||||||
|
-- Nothing ->
|
||||||
|
-- Indeterminate
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
Nothing ->
|
||||||
|
( Attributes.classList
|
||||||
|
[ ( "checkbox-Label", True )
|
||||||
|
, ( "checkbox-Indeterminate", True )
|
||||||
|
]
|
||||||
|
, css
|
||||||
|
[ cursor pointer
|
||||||
|
, outline none
|
||||||
|
|
||||||
|
--TODO These styles depend on the theme
|
||||||
|
--, case maybeChecked of
|
||||||
|
-- Just True ->
|
||||||
|
-- Checked
|
||||||
|
-- Just False ->
|
||||||
|
-- Unchecked
|
||||||
|
-- Nothing ->
|
||||||
|
-- Indeterminate
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
getLabelClass : Maybe Bool -> RootHtml.Attribute msg
|
getLabelClass : Maybe Bool -> RootHtml.Attribute msg
|
||||||
|
Loading…
Reference in New Issue
Block a user