Refactor Projects component to use structured tags with icons and add link icon SVG

This commit is contained in:
aferrer committed 2025-10-31 16:25:18 +00:00
1 parent 1940fce993
commit 789ab25c72
3 files changed
+33 -13

No files matched your search

+22 -12
View File
@@ -1,12 +1,18 @@
--- ---
import { Icon } from "astro-icon/components";
import Section from "./ui/Section.astro"; import Section from "./ui/Section.astro";
const { projects } = Astro.props; const { projects } = Astro.props;
interface project { interface ProjectTag {
name: string;
icon?: string;
}
interface ProjectProps {
title: string; title: string;
description: string; description: string;
tags: string[]; tags: ProjectTag[];
liveUrl?: string; liveUrl?: string;
repoUrl: string; repoUrl: string;
} }
@@ -17,7 +23,7 @@ interface project {
</h3> </h3>
<div class="space-y-12"> <div class="space-y-12">
{ {
projects.map((project: project) => ( projects.map((project: ProjectProps) => (
<div class="section-card overflow-hidden md:flex"> <div class="section-card overflow-hidden md:flex">
<div class="p-8 flex-1"> <div class="p-8 flex-1">
<h4 class="text-xl font-bold text-white mb-2"> <h4 class="text-xl font-bold text-white mb-2">
@@ -25,13 +31,15 @@ interface project {
</h4> </h4>
<p class="text-gray-400 mb-4">{project.description}</p> <p class="text-gray-400 mb-4">{project.description}</p>
<div class="flex flex-wrap gap-2 mb-6"> <div class="flex flex-wrap gap-2 mb-6">
{project.tags.map((tag) => ( {project.tags.map((tag: ProjectTag) => (
<span class="bg-gray-700 text-sky-300 text-xs font-semibold px-2.5 py-1 rounded-full"> <span class="inline-flex items-center px-3 py-1 bg-gray-800 text-gray-300 text-sm rounded-full">
{tag} <Icon
name={tag.icon}
class="w-6 h-6 mr-2"
data-inline="false"
/>
</span> </span>
))} ))}
</div>
<div class="flex items-center gap-4">
{project.liveUrl && ( {project.liveUrl && (
<a <a
href={project.liveUrl} href={project.liveUrl}
@@ -39,14 +47,16 @@ interface project {
rel="noopener noreferrer" rel="noopener noreferrer"
class="inline-flex items-center gap-2 text-sky-400 hover:text-sky-300 transition-colors" class="inline-flex items-center gap-2 text-sky-400 hover:text-sky-300 transition-colors"
> >
<span <Icon
class="iconify" name="link"
data-icon="mdi:open-in-new" class="w-6 h-6 mr-2 hover:scale-110 hover:text-gray-100 transition-transform duration-300"
data-inline="false" data-inline="false"
fill={"bg-white"}
/> />
URL Live
</a> </a>
)} )}
</div>
<div class="flex items-center gap-4">
{project.repoUrl && ( {project.repoUrl && (
<a <a
href={project.repoUrl} href={project.repoUrl}
+5 -1
View File
@@ -66,7 +66,11 @@ export const projects = [
title: "HAM Italia - Sitio Web Corporativo", title: "HAM Italia - Sitio Web Corporativo",
description: description:
"Sitio web corporativo desarrollado con Astro, React y Tailwind CSS para HAM Italia. Incluye múltiples secciones informativas, formularios de contacto y solicitud de tarjetas, optimizado para rendimiento, SEO y experiencia de usuario.", "Sitio web corporativo desarrollado con Astro, React y Tailwind CSS para HAM Italia. Incluye múltiples secciones informativas, formularios de contacto y solicitud de tarjetas, optimizado para rendimiento, SEO y experiencia de usuario.",
tags: ["Astro", "React", "Tailwind CSS"], tags: [
{ name: "Astro", icon: "astro" },
{ name: "React", icon: "react" },
{ name: "Tailwind CSS", icon: "tailwind" },
],
liveUrl: "https://hamitalia.com", liveUrl: "https://hamitalia.com",
repoUrl: null, repoUrl: null,
}, },
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M22 2.00001L11.75 12.25" stroke="#d1d5dc" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M21.9998 6.49999L21.9998 1.99999L17.0568 1.99999" stroke="#d1d5dc" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M11 2H4C2.89543 2 2 2.89543 2 4V20C2 21.1046 2.89543 22 4 22H20C21.1046 22 22 21.1046 22 20V12.75" stroke="#d1d5dc" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 688 B