website/frontend/src/Config/Helpers/Cards/Inner/ToolTip.elm

136 lines
3.9 KiB
Elm
Raw Normal View History

2025-01-02 02:33:57 -06:00
module Config.Helpers.Cards.Inner.ToolTip exposing
( tooltip
, tooltipImage
)
2024-11-28 00:33:22 -06:00
2024-12-27 01:30:21 -06:00
import Config.Style.Colour.Helpers exposing (colourTheme)
2024-12-09 19:53:09 -06:00
import Config.Style.Transitions exposing (transitionStyleSlow)
2025-01-02 02:33:57 -06:00
import Element as E
exposing
( Attribute
, alignLeft
, alignRight
, below
, centerX
, centerY
, el
, fill
, height
, htmlAttribute
, image
, inFront
, mouseOver
, moveLeft
, none
, padding
, px
, rgba
, text
, transparent
, width
)
import Element.Background as B exposing (color)
2024-12-09 19:53:09 -06:00
import Element.Border as D
2025-01-02 02:33:57 -06:00
exposing
( color
, rounded
, shadow
, width
)
2024-11-28 00:33:22 -06:00
import Element.Font as F
2025-01-02 02:33:57 -06:00
exposing
( center
, regular
, size
)
import Html.Attributes as H exposing (style)
2024-11-28 00:33:22 -06:00
2025-01-02 02:33:57 -06:00
tooltip : String -> Bool -> Attribute msg
tooltip content isLeft =
2024-11-28 00:33:22 -06:00
inFront <|
el
2025-01-02 02:33:57 -06:00
[ E.width fill
2024-11-28 00:33:22 -06:00
, height fill
, transparent True
, mouseOver [ transparent False ]
, htmlAttribute <| H.style "z-index" "4"
2024-12-09 19:53:09 -06:00
, transitionStyleSlow
2024-11-28 00:33:22 -06:00
, below <|
2025-01-02 02:33:57 -06:00
el
[ htmlAttribute (H.style "pointerEvents" "none")
, case isLeft of
True ->
alignLeft
False ->
alignRight
]
<|
2024-11-28 00:33:22 -06:00
el
2025-01-02 02:33:57 -06:00
[ E.width fill
2024-11-28 00:33:22 -06:00
, htmlAttribute <| H.style "z-index" "4"
, F.size 15
, F.center
, F.regular
, B.color colourTheme.backgroundLightGrey
, F.color colourTheme.textLightGrey
2024-11-28 00:33:22 -06:00
, padding 15
, D.color colourTheme.textLightOrange
2024-11-28 00:33:22 -06:00
, D.rounded 5
, D.width 2
, D.shadow
{ offset = ( 0, 3 )
, blur = 6
, size = 0
, color = rgba 0 0 0 0.32
}
]
(text content)
]
none
2024-12-19 01:43:02 -06:00
tooltipImage : String -> Attribute msg
tooltipImage content =
inFront <|
el
2025-01-02 02:33:57 -06:00
[ E.width fill
2024-12-19 01:43:02 -06:00
, height fill
, transparent True
, mouseOver [ transparent False ]
, htmlAttribute <| H.style "z-index" "4"
, transitionStyleSlow
2024-12-19 02:59:18 -06:00
, below <|
2024-12-19 01:43:02 -06:00
el
[ htmlAttribute (H.style "pointerEvents" "none")
2024-12-19 02:59:18 -06:00
, moveLeft 200
2024-12-19 01:43:02 -06:00
]
<|
el
2025-01-02 02:33:57 -06:00
[ E.width <| px 400
2024-12-19 01:43:02 -06:00
, htmlAttribute <| H.style "z-index" "4"
, B.color colourTheme.backgroundLightGrey
, D.color colourTheme.textLightOrange
, D.rounded 5
, D.width 2
, D.shadow
{ offset = ( 0, 3 )
, blur = 6
, size = 0
, color = rgba 0 0 0 0.32
}
]
(image
2025-01-02 02:33:57 -06:00
[ E.width fill
2024-12-19 01:43:02 -06:00
, height fill
, centerX
, centerY
]
{ src = content
, description = "Tooltip image"
}
)
]
none