import { Config } from "@/src/types/config"; import { library } from "@fortawesome/fontawesome-svg-core"; import { fab } from "@fortawesome/free-brands-svg-icons"; import { far } from "@fortawesome/free-regular-svg-icons"; import { fas } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import Image from "next/image"; import Avatar from "./components/Avatar"; const Config: Config = require("../../config.yml") as any; library.add(fab, far, fas); // Loading in the icons from FontAwesome export default function Home() { const { background, infoCard, avatar, name, links, socialLinks, options, description, theme, } = Config; // All of the settings pulled from the config file // Theme colors to use when using the selected theme // all used colors are from TailwindCSS const themeColors: { [key: string]: { backgroundColor: string; infoCardColor: string; textColor: string; buttonTextColor: string; footerTextColor: string; }; } = { dark: { backgroundColor: "bg-neutral-800", infoCardColor: "bg-neutral-900", textColor: "text-white", buttonTextColor: "text-white", footerTextColor: "text-blue-300", }, light: { backgroundColor: "bg-gray-300", infoCardColor: "bg-white", textColor: "text-black", buttonTextColor: "text-white", footerTextColor: "text-black", }, }; const selectedTheme = themeColors[theme] || themeColors.dark; // The theme to use (fallback of dark) return ( <>
{/* Background Image */} {background.showBackground && background.backgroundImage && ( Background image )}

{name}

{/* Description of user */}

{description}

{/* Links (Buttons) */}
{links && links.map((link, index) => { const icons: any = link.icon?.split(" ") ?? []; let color: any = link.color; // Here so old configs don't break if (color.normal != undefined) { color = color.normal; } else { color = link.color; } return ( {link.icon && }

{link.title}

); })}
{/* Social Links */}
{socialLinks && socialLinks.map((link, index) => { const icons: any = link.icon?.split(" ") ?? []; return ( {link.icon && ( )} ); })}
{/* Footer */}
{options.showSourceLink && ( Website Source )}
); }