Refactor: abstract tooltip into reusable component

This commit is contained in:
2026-06-10 07:01:03 +00:00
parent 85dfdc8cc9
commit f1cc0ac567
2 changed files with 14 additions and 9 deletions
+2 -9
View File
@@ -1,6 +1,7 @@
---
import { Icon } from "astro-icon/components";
import Section from "./ui/Section.astro";
import Tooltip from "./ui/Tooltip.astro";
const { skills } = Astro.props;
@@ -22,15 +23,7 @@ interface SkillProps {
data-inline="false"
/>
<!-- Tooltip con flecha -->
<div class="absolute top-full left-1/2 mt-3 -translate-x-1/2 hidden group-hover:flex flex-col items-center">
<!-- Cuerpo del tooltip -->
<div class="bg-gray-800 text-white text-sm px-2 py-1 rounded shadow-lg whitespace-nowrap relative">
{skill.name}
<!-- Flechita -->
<div class="absolute -top-1 left-1/2 -translate-x-1/2 w-2 h-2 bg-gray-800 rotate-45"></div>
</div>
</div>
<Tooltip tooltip={skill.name} />
</div>
</div>
))}
+12
View File
@@ -0,0 +1,12 @@
---
const { tooltip } = Astro.props;
---
<!-- Tooltip con flecha -->
<div class="absolute top-full left-1/2 mt-3 -translate-x-1/2 hidden group-hover:flex flex-col items-center">
<!-- Cuerpo del tooltip -->
<div class="bg-gray-800 text-white text-sm px-2 py-1 rounded shadow-lg whitespace-nowrap relative">
{tooltip}
<!-- Flechita -->
<div class="absolute -top-1 left-1/2 -translate-x-1/2 w-2 h-2 bg-gray-800 rotate-45"></div>
</div>
</div>