mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2025-01-04 20:56:47 +03:00
Merge pull request #688 from NoRedInk/raven/fix-segmented-control-styles
SegmentedControl honours FillContainer
This commit is contained in:
commit
2f2dbae6e5
@ -126,7 +126,13 @@ viewRadioGroup config =
|
||||
{ id = option.idString ++ "-tooltip"
|
||||
, trigger = inner
|
||||
}
|
||||
option.tooltip
|
||||
(case config.positioning of
|
||||
Left FillContainer ->
|
||||
Tooltip.containerCss [ Css.width (Css.pct 100) ] :: option.tooltip
|
||||
|
||||
_ ->
|
||||
option.tooltip
|
||||
)
|
||||
|
||||
name =
|
||||
dashify (String.toLower config.legend)
|
||||
|
@ -63,7 +63,7 @@ example =
|
||||
, SegmentedControl.viewRadioGroup
|
||||
{ legend = "SegmentedControls 'viewSelectRadio' example"
|
||||
, onSelect = SelectRadio
|
||||
, options = List.take options.count (buildRadioOptions state.radioTooltip options.content)
|
||||
, options = List.take options.count (buildRadioOptions options state.radioTooltip options.content)
|
||||
, selected = state.optionallySelected
|
||||
, positioning = options.positioning
|
||||
}
|
||||
@ -146,8 +146,8 @@ buildOptions { content, longContent, tooltips } openTooltip =
|
||||
]
|
||||
|
||||
|
||||
buildRadioOptions : Maybe Int -> Content -> List (SegmentedControl.Radio Int Msg)
|
||||
buildRadioOptions currentlyHovered content =
|
||||
buildRadioOptions : { options | tooltips : Bool } -> Maybe Int -> Content -> List (SegmentedControl.Radio Int Msg)
|
||||
buildRadioOptions options currentlyHovered content =
|
||||
let
|
||||
buildOption : Int -> ( String, Svg ) -> SegmentedControl.Radio Int Msg
|
||||
buildOption value ( text, icon ) =
|
||||
@ -162,20 +162,24 @@ buildRadioOptions currentlyHovered content =
|
||||
, value = value
|
||||
, idString = String.fromInt value
|
||||
, tooltip =
|
||||
[ Tooltip.plaintext text
|
||||
, Tooltip.open (currentlyHovered == Just value)
|
||||
, Tooltip.fitToContent
|
||||
, Tooltip.onHover
|
||||
(\hovered ->
|
||||
HoverRadio
|
||||
(if hovered then
|
||||
Just value
|
||||
if options.tooltips then
|
||||
[ Tooltip.plaintext text
|
||||
, Tooltip.open (currentlyHovered == Just value)
|
||||
, Tooltip.fitToContent
|
||||
, Tooltip.onHover
|
||||
(\hovered ->
|
||||
HoverRadio
|
||||
(if hovered then
|
||||
Just value
|
||||
|
||||
else
|
||||
Nothing
|
||||
)
|
||||
)
|
||||
]
|
||||
else
|
||||
Nothing
|
||||
)
|
||||
)
|
||||
]
|
||||
|
||||
else
|
||||
[]
|
||||
, attributes = []
|
||||
}
|
||||
in
|
||||
|
Loading…
Reference in New Issue
Block a user