feat: constants; update deps

This commit is contained in:
Ayo 2023-09-25 22:51:49 +02:00
parent c8c9aa4995
commit 32666b58c9
6 changed files with 2645 additions and 5132 deletions

7632
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
{
"name": "@example/basics",
"name": "@ayco/personal-website",
"type": "module",
"version": "0.0.1",
"private": true,
@ -12,10 +12,10 @@
"deploy": "astro build && scp -r dist/. ayo@ayco.io:~/ayco.io-astro/dist"
},
"dependencies": {
"@astro-reactive/form": "^0.8.1",
"@astro-reactive/validator": "^0.3.4",
"astro": "^2.5.5",
"astro-github-stats": "^0.5.0",
"astro-icon": "^0.8.0"
"@astro-reactive/form": "^0.9.0",
"@astro-reactive/validator": "^0.4.0",
"astro": "^3.1.4",
"astro-github-stats": "^0.6.0",
"astro-iconify": "^1.2.0"
}
}

View file

@ -1,11 +1,6 @@
---
import Icon from "astro-icon";
export type Link = {
url: string;
icon: string;
set?: string;
text?: string;
};
import Icon from "astro-iconify";
import type { Link } from "../constants/links";
export interface Props {
links: Array<Link>;
@ -14,26 +9,29 @@ export interface Props {
let { links } = Astro.props;
if (Astro.url.pathname !== "/") {
links = [{
url: "/",
icon: "home",
}].concat(links);
links = [
{
url: "/",
icon: "home",
},
].concat(links);
}
---
<nav>
<div id="wrapper">
{
links
.filter((link) => link.url !== "")
.map((link) => (
<a href={link.url}>
<Icon pack={link.set ?? "mdi"} name={link.icon} /> {link.text ?? link.icon}
</a>
))
}
</div>
</nav>
<nav>
<div id="wrapper">
{
links
.filter((link) => link.url !== "")
.map((link) => (
<a href={link.url}>
<Icon pack={link.set ?? "mdi"} name={link.icon} />{" "}
{link.text ?? link.icon}
</a>
))
}
</div>
</nav>
<style>
nav {
@ -64,11 +62,11 @@ if (Astro.url.pathname !== "/") {
}
@media only screen and (max-device-width: 360px) {
#wrapper { text-align: center; }
#wrapper {
text-align: center;
}
nav a {
padding: 0.5em;
}
}
</style>

30
src/constants/links.ts Normal file
View file

@ -0,0 +1,30 @@
export type Link = {
url: string;
icon: string;
set?: string;
text?: string;
};
const links: Link[] = [
{
url: "https://ayos.blog",
icon: "blog",
},
{
url: "https://ayco.io/@ayo",
icon: "mastodon",
text: "social"
},
{
url: "https://ayco.io/gh/",
icon: "github",
},
{
url: "https://www.npmjs.com/~aayco",
icon: "npm",
set: "gg"
}
];
export default links;

View file

@ -2,14 +2,13 @@
import "./reset.css";
import Head from "../components/Head.astro";
import Nav from "../components/Nav.astro";
import type { Link } from "../components/Nav.astro";
import links from "../constants/links";
export interface Props {
title?: string;
description?: string;
links?: Link[];
}
const { links = [], title, description } = Astro.props;
const { title, description } = Astro.props;
---

View file

@ -2,41 +2,19 @@
import Layout from "../layouts/Layout.astro";
import Card from "../components/Card.astro";
import Footer from "../components/Footer.astro";
import type { Link } from "../components/Nav.astro";
const response = await fetch('https://social.ayco.io/api/v1/accounts/109547735999980313')
let {
display_name,
avatar,
note
} = await response.json();
const response = await fetch(
"https://social.ayco.io/api/v1/accounts/109547735999980313"
);
let { display_name, avatar, note } = await response.json();
const [first_name, last_name] = display_name.split(' ')
note = note.replace('<span class="">ayco.io/gh/', '<span class="">').replace('<span class="">ayco.io/sh/', '<span class="">')
const links: Link[] = [
{
url: "https://ayos.blog",
icon: "blog",
},
{
url: "https://ayco.io/@ayo",
icon: "mastodon",
text: "social"
},
{
url: "https://ayco.io/gh/",
icon: "github",
},
{
url: "https://www.npmjs.com/~aayco",
icon: "npm",
set: "gg"
}
];
const [first_name, last_name] = display_name.split(" ");
note = note
.replace('<span class="">ayco.io/gh/', '<span class="">')
.replace('<span class="">ayco.io/sh/', '<span class="">');
---
<Layout links={links}>
<Layout>
<section class="highlighted-section">
<div class="highlighted-section__content">
<img
@ -52,7 +30,9 @@ const links: Link[] = [
<div class="highlighted__note" set:html={note} />
<a href="/now" class="now-wrapper">
<span class="now-label">Now</span>
<span class="status">Certified Software Architecture Professional</span>
<span class="status"
>Certified Software Architecture Professional</span
>
</a>
</div>
</div>
@ -229,4 +209,4 @@ const links: Link[] = [
color: white;
font-weight: normal;
}
</style>
</style>