From c76a4ddf46272467744c49c149157effc489f4bf Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Wed, 21 Oct 2020 09:08:45 -0700 Subject: [PATCH] :skull: tooltip: --- src/Nri/Ui/ClickableSvg/V2.elm | 77 ---------------------------------- 1 file changed, 77 deletions(-) diff --git a/src/Nri/Ui/ClickableSvg/V2.elm b/src/Nri/Ui/ClickableSvg/V2.elm index cffe8bd4..10c53390 100644 --- a/src/Nri/Ui/ClickableSvg/V2.elm +++ b/src/Nri/Ui/ClickableSvg/V2.elm @@ -8,18 +8,11 @@ module Nri.Ui.ClickableSvg.V2 exposing , withBorder , primary, secondary, danger, dangerSecondary , custom, css - , withTooltipAbove, withTooltipBelow ) {-| -# Post-release patches - - - uses ClickableAttributes - - adds tooltip helpers - - # Create a button or link @docs button, link @@ -49,11 +42,6 @@ module Nri.Ui.ClickableSvg.V2 exposing @docs custom, css - -## Tooltips - -@docs withTooltipAbove, withTooltipBelow - -} import Accessibility.Styled.Widget as Widget @@ -310,67 +298,6 @@ css styles = --- TOOLTIPS - - -type alias TooltipSettings msg = - { position : Tooltip.Position - , isOpen : Bool - , onShow : Bool -> msg - , id : String - } - - -showTooltip : String -> Maybe (TooltipSettings msg) -> Html msg -> Html msg -showTooltip label maybeSettings buttonOrLink = - case maybeSettings of - Just { position, onShow, isOpen, id } -> - let - tooltipSettings = - { trigger = Tooltip.OnHover - , onTrigger = onShow - , isOpen = isOpen - , triggerHtml = buttonOrLink - , extraButtonAttrs = [] - , id = id ++ "__clickable-svg-tooltip" - } - in - Tooltip.tooltip [ Html.text label ] - |> Tooltip.withPosition position - |> Tooltip.withWidth Tooltip.FitToContent - |> Tooltip.withPadding Tooltip.SmallPadding - |> Tooltip.primaryLabel tooltipSettings - - Nothing -> - buttonOrLink - - -withTooltip : Tooltip.Position -> { id : String, isOpen : Bool, onShow : Bool -> msg } -> Attribute msg -withTooltip position { id, isOpen, onShow } = - set - (\config -> - { config - | tooltip = - Just { position = position, id = id, isOpen = isOpen, onShow = onShow } - } - ) - - -{-| DEPRECATED: prefer to use the Tooltip module directly. --} -withTooltipAbove : { id : String, isOpen : Bool, onShow : Bool -> msg } -> Attribute msg -withTooltipAbove = - withTooltip Tooltip.OnTop - - -{-| DEPRECATED: prefer to use the Tooltip module directly. --} -withTooltipBelow : { id : String, isOpen : Bool, onShow : Bool -> msg } -> Attribute msg -withTooltipBelow = - withTooltip Tooltip.OnBottom - - - -- INTERNALS @@ -392,7 +319,6 @@ build label icon = , disabled = False , customAttributes = [] , customStyles = [] - , tooltip = Nothing , hasBorder = False , theme = Secondary } @@ -411,7 +337,6 @@ type alias ButtonOrLinkAttributes msg = , disabled : Bool , customAttributes : List (Html.Attribute msg) , customStyles : List Style - , tooltip : Maybe (TooltipSettings msg) , hasBorder : Bool , theme : Theme } @@ -431,7 +356,6 @@ renderButton ((ButtonOrLink config) as button_) = ) [ renderIcon config ] - |> showTooltip config.label config.tooltip type Link @@ -465,7 +389,6 @@ renderLink ((ButtonOrLink config) as link_) = ) [ renderIcon config ] - |> showTooltip config.label config.tooltip renderIcon : ButtonOrLinkAttributes msg -> Html msg