Merge pull request #81 from NoRedInk/ink__checkbox-opacity

Ink  checkbox opacity
This commit is contained in:
Tessa 2018-06-27 10:12:14 -07:00 committed by GitHub
commit 469d72df59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 18 deletions

View File

@ -61,7 +61,7 @@ type IsSelected
{-| -}
type Theme
= Square
| LockOnInside
| Locked
selectedToMaybe : IsSelected -> Maybe Bool
@ -119,7 +119,7 @@ buildCheckbox assets modifierClasses model labelContent =
, labelContent = labelContent
}
LockOnInside ->
Locked ->
{ containerClasses = toClassList (modifierClasses ++ [ "LockOnInsideClass" ])
, labelStyles = lockLabelStyles model assets.checkboxLockOnInside_svg
, labelClasses = labelClass model.selected
@ -138,10 +138,12 @@ squareLabelStyles model image =
]
in
css
(if model.disabled then
[ cursor auto, opacity (num 0.4) ] ++ baseStyles
else
[ cursor pointer ] ++ baseStyles
(baseStyles
++ (if model.disabled then
[ cursor auto, checkboxImageSelector [ opacity (num 0.4) ] ]
else
[ cursor pointer ]
)
)
@ -156,10 +158,14 @@ lockLabelStyles model image =
]
in
css
(if model.disabled then
[ cursor auto, opacity (num 0.4) ] ++ baseStyles
else
[ cursor pointer ] ++ baseStyles
(baseStyles
++ (if model.disabled then
[ cursor auto
, checkboxImageSelector [ opacity (num 0.4) ]
]
else
[ cursor pointer ]
)
)
@ -168,7 +174,6 @@ positioning =
batch
[ display inlineBlock
, padding4 (px 13) zero (px 13) (px 35)
, verticalAlign middle
]
@ -183,13 +188,26 @@ textStyle =
addIcon : Asset -> Style
addIcon icon =
batch
[ backgroundImage icon
, backgroundRepeat noRepeat
, backgroundSize (px 24)
, property "background-position" "left center"
[ position relative
, checkboxImageSelector
[ backgroundImage icon
, backgroundRepeat noRepeat
, backgroundSize (px 24)
, property "content" "''"
, position absolute
, left zero
, top (px 10)
, width (px 24)
, height (px 24)
]
]
checkboxImageSelector : List Style -> Style
checkboxImageSelector =
before
labelClass : IsSelected -> Html.Styled.Attribute msg
labelClass isSelected =
case isSelected of

View File

@ -68,7 +68,7 @@ premium assets config =
, disabled = config.disabled
, theme =
if isLocked then
Checkbox.LockOnInside
Checkbox.Locked
else
Checkbox.Square
, noOpMsg = config.noOpMsg

View File

@ -132,11 +132,11 @@ viewLockedOnInsideCheckbox id state =
Checkbox.viewWithLabel
assets
{ identifier = id
, label = "I'm a locked Checkbox on the inside"
, label = "I'm a locked Checkbox"
, setterMsg = ToggleCheck id
, selected = Checkbox.NotSelected
, disabled = True
, theme = Checkbox.LockOnInside
, theme = Checkbox.Locked
, noOpMsg = NoOp
}