Files
rafa-links/src/pages/index.astro

51 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-01-07 22:21:53 -06:00
---
2022-08-17 23:38:12 -05:00
import MainLayout from "../layouts/main.astro";
2022-01-07 22:21:53 -06:00
import profileData from '../data/profile.json';
2022-01-18 18:44:26 -06:00
import Icon from "../components/icon.svelte";
2022-01-07 22:21:53 -06:00
2022-08-12 14:54:04 -05:00
type IconData = {
2022-08-17 23:38:12 -05:00
name: string;
url: string;
icon: string;
iconUrl?: string;
}
2022-08-12 14:54:04 -05:00
2022-01-07 22:21:53 -06:00
const profileName = profileData.name;
const personalLinks = [];
const profesionalLinks = [];
for (let link of profileData.personalLinks) {
2022-08-17 23:38:12 -05:00
const withUrl: IconData = { ...link };
2022-01-07 22:21:53 -06:00
2022-01-19 16:35:47 -06:00
withUrl.iconUrl = `/icons/${link.icon}.svg`;
2022-01-07 22:21:53 -06:00
personalLinks.push(withUrl);
}
for (let link of profileData.profesionalLinks) {
2022-08-17 23:38:12 -05:00
const withUrl: IconData = { ...link };
2022-01-07 22:21:53 -06:00
2022-01-19 16:35:47 -06:00
withUrl.iconUrl = `/icons/${link.icon}.svg`;
2022-01-07 22:21:53 -06:00
profesionalLinks.push(withUrl);
}
---
2022-08-17 23:38:12 -05:00
<MainLayout>
<h2 class="font-mono font-bold uppercase text-xl my-14 mx-auto tracking-wide w-11/12 max-w-5xl dark:text-white">
Personal Links</h2>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 w-11/12 max-w-5xl my-2 mx-auto">
{personalLinks.map(perLink => (
2022-08-25 08:03:59 -05:00
<Icon client:load perLink={perLink} profileName={profileName} />
2022-08-17 23:38:12 -05:00
))}
</div>
<h2 class="font-mono font-bold uppercase text-xl my-14 mx-auto tracking-wide w-11/12 max-w-5xl dark:text-white">
Profesional Links</h2>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 w-11/12 max-w-5xl my-2 mx-auto">
{profesionalLinks.map(perLink => (
<Icon client:load perLink={perLink} profileName={profileName} />
))}
</div>
</MainLayout>