Refactor: abstract tooltip into reusable component
This commit is contained in:
1 parent
85dfdc8cc9
commit
f1cc0ac567
2 files changed
+14
-9
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
---
|
---
|
||||||
import { Icon } from "astro-icon/components";
|
import { Icon } from "astro-icon/components";
|
||||||
import Section from "./ui/Section.astro";
|
import Section from "./ui/Section.astro";
|
||||||
|
import Tooltip from "./ui/Tooltip.astro";
|
||||||
|
|
||||||
const { skills } = Astro.props;
|
const { skills } = Astro.props;
|
||||||
|
|
||||||
@@ -22,15 +23,7 @@ interface SkillProps {
|
|||||||
data-inline="false"
|
data-inline="false"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- Tooltip con flecha -->
|
<Tooltip tooltip={skill.name} />
|
||||||
<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>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -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>
|
||||||
Reference in new issue
Block a user