feat: add about command with social links
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import commandJson from "../../config.json" assert { type: "json" };
|
||||
|
||||
interface Social {
|
||||
email: string;
|
||||
git: string;
|
||||
linkedin: string;
|
||||
youtube: string;
|
||||
"pgp-key": string;
|
||||
}
|
||||
|
||||
interface Command {
|
||||
aboutGreeting: string;
|
||||
social: Social;
|
||||
}
|
||||
|
||||
const command: Command = commandJson;
|
||||
|
||||
interface AboutItem {
|
||||
label: string;
|
||||
icon: string;
|
||||
url: string;
|
||||
display: string;
|
||||
}
|
||||
|
||||
const createAbout = (): string[] => {
|
||||
const about: string[] = [];
|
||||
|
||||
about.push("<br>");
|
||||
about.push(command.aboutGreeting);
|
||||
about.push("<br>");
|
||||
|
||||
const items: AboutItem[] = [
|
||||
{
|
||||
label: "Email",
|
||||
icon: `<i class='fa-solid fa-envelope'></i>`,
|
||||
url: `mailto:${command.social.email}`,
|
||||
display: command.social.email,
|
||||
},
|
||||
{
|
||||
label: "Git",
|
||||
icon: `<i class='fa-brands fa-git-alt'></i>`,
|
||||
url: `https://src.panahifar.ir/${command.social.git}`,
|
||||
display: `nagini/${command.social.git}`,
|
||||
},
|
||||
{
|
||||
label: "Linkedin",
|
||||
icon: `<i class='fa-brands fa-linkedin'></i>`,
|
||||
url: `https://www.linkedin.com/in/${command.social.linkedin}`,
|
||||
display: `linkedin/${command.social.linkedin}`,
|
||||
},
|
||||
{
|
||||
label: "YouTube",
|
||||
icon: `<i class='fa-brands fa-youtube'></i>`,
|
||||
url: `https://www.youtube.com/@${command.social.youtube}`,
|
||||
display: `youtube/${command.social.youtube}`,
|
||||
},
|
||||
{
|
||||
label: "PGP Key",
|
||||
icon: `<i class='fa-solid fa-key'></i>`,
|
||||
url: `https://src.panahifar.ir/pgp/C86437BFC43196C6.asc`,
|
||||
display: `key/0xC86437BFC43196C6`,
|
||||
},
|
||||
];
|
||||
|
||||
const formatLine = ({ label, icon, url, display }: AboutItem) => {
|
||||
return `
|
||||
<div style="display: flex; align-items: center; margin-bottom: 6px; font-family: monospace;">
|
||||
<span style="min-width: 130px;">${icon} ${label}</span>
|
||||
<a target="_blank" href="${url}" style="margin-left: 12px;">${display}</a>
|
||||
</div>
|
||||
`;
|
||||
};
|
||||
|
||||
items.forEach((item) => about.push(formatLine(item)));
|
||||
about.push("<br>");
|
||||
|
||||
return about;
|
||||
};
|
||||
|
||||
export const ABOUT = createAbout();
|
||||
Reference in New Issue
Block a user