skill_web/components/
tooltip.rs1use yew::prelude::*;
7
8#[derive(Properties, PartialEq)]
9pub struct TooltipProps {
10 pub text: String,
12}
13
14#[function_component(Tooltip)]
25pub fn tooltip(props: &TooltipProps) -> Html {
26 html! {
27 <span class="inline-flex items-center ml-1 group relative">
28 <svg
30 class="w-4 h-4 text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-300 cursor-help transition-colors"
31 fill="currentColor"
32 viewBox="0 0 20 20"
33 xmlns="http://www.w3.org/2000/svg"
34 >
35 <path
36 fill-rule="evenodd"
37 d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z"
38 clip-rule="evenodd"
39 />
40 </svg>
41
42 <span class="invisible group-hover:visible absolute z-50 w-64 p-2 text-xs text-white bg-gray-900 dark:bg-gray-800 rounded shadow-lg -top-10 left-5 pointer-events-none">
44 { &props.text }
45 <svg
47 class="absolute text-gray-900 dark:text-gray-800 h-2 w-full left-0 top-full"
48 x="0px"
49 y="0px"
50 viewBox="0 0 255 255"
51 >
52 <polygon class="fill-current" points="0,0 127.5,127.5 255,0"/>
53 </svg>
54 </span>
55 </span>
56 }
57}