Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
cslegasse committed Nov 26, 2024
1 parent 0d22f8a commit ec0be1c
Show file tree
Hide file tree
Showing 65 changed files with 15,182 additions and 11,320 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
36 changes: 35 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
*.DS_Store
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023-2024 Legasse Remon
Copyright (c) 2024 L

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Binary file added app/favicon.ico
Binary file not shown.
114 changes: 114 additions & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

.prose .anchor {
@apply absolute invisible no-underline;

margin-left: -1em;
padding-right: 0.5em;
width: 80%;
max-width: 700px;
cursor: pointer;
}

.anchor:hover {
@apply visible;
}

.prose a {
@apply underline transition-all decoration-neutral-400 dark:decoration-neutral-600 underline-offset-2 decoration-[0.1em];
}

.prose *:hover > .anchor {
@apply visible;
}

.prose pre {
@apply bg-neutral-50 dark:bg-neutral-900 rounded-lg overflow-x-auto border border-neutral-200 dark:border-neutral-900 py-2 px-3 text-sm;
}

.prose code {
@apply px-1 py-0.5 rounded-lg;
}

.prose pre code {
@apply p-0;
border: initial;
line-height: 1.5;
}

.prose code span {
@apply font-medium;
}

.prose img {
/* Don't apply styles to next/image */
@apply m-0;
}

.prose p {
@apply my-4 text-neutral-600 dark:text-neutral-200;
}

.prose h1 {
@apply text-3xl font-semibold tracking-tight mt-6 mb-2;
}

.prose h2 {
@apply text-xl font-medium tracking-tight mt-6 mb-2;
}

.prose h3 {
@apply text-xl font-medium tracking-tight mt-6 mb-2;
}

.prose h4 {
@apply text-lg font-medium tracking-tight mt-6 mb-2;
}

.prose strong {
@apply font-medium;
}

.prose ul {
@apply list-disc pl-6;
}

.prose ol {
@apply list-decimal pl-6;
}

.prose > :first-child {
/* Override removing top margin, causing layout shift */
margin-top: 1.25em !important;
margin-bottom: 1.25em !important;
}

pre::-webkit-scrollbar {
display: none;
}

pre {
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}

/* Remove Safari input shadow on mobile */
input[type="text"],
input[type="email"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}

table {
display: block;
max-width: fit-content;
overflow-x: auto;
white-space: nowrap;
}

.title {
text-wrap: balance;
}
46 changes: 46 additions & 0 deletions app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { Inter, JetBrains_Mono, EB_Garamond } from 'next/font/google';
import { fontStyle } from '@/website.config';
import './globals.css';
import { websiteInfo } from '@/website.config';
import Header from '@/components/Header';
import { ThemeProvider } from '@/components/ThemeProvider';

const inter = Inter({
subsets: ['latin'],
});

const mono = JetBrains_Mono({
subsets: ['latin'],
});

const serif = EB_Garamond({
subsets: ['latin'],
});

const font = {
sans: inter,
serif: serif,
mono: mono,
}[fontStyle];

export const metadata = {
title: websiteInfo.title,
description: websiteInfo.description,
};

export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={`${font.className} bg-neutral-50 dark:bg-neutral-800`}>
<ThemeProvider
attribute="class"
defaultTheme="light"
disableTransitionOnChange
>
<Header />
{children}
</ThemeProvider>
</body>
</html>
);
}
24 changes: 24 additions & 0 deletions app/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import AboutSection from "@/components/AboutSection";
import NewsSection from "@/components/NewsSection";
import ProjectSection from "@/components/ProjectSection";
import PublicationsSection from "@/components/SelectedPublicationsSection";
import bibtex from "@/data/bib/Publications.bib";
import { homepageSection } from "@/website.config";

export default function Page() {
return (
<main className="md:w-[40rem] m-auto px-8 mt-32 flex flex-col gap-10 mb-20">
{homepageSection.AboutSection && <AboutSection />}
{homepageSection.NewsSection && <NewsSection />}
{homepageSection.SelectedPublicationsSection && (
<PublicationsSection bibtex={bibtex} />
)}
{homepageSection.ProjectSection && (
<div className="flex flex-col gap-3">
<h1 className="text-3xl font-semibold">Projects</h1>
<ProjectSection />
</div>
)}
</main>
);
}
42 changes: 42 additions & 0 deletions app/projects/[slug]/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { CustomMDX } from '@/components/mdx';
import { Button } from '@/components/ui/button';
import Link from 'next/link';
import { RiArrowLeftSLine } from '@remixicon/react';
import { formatDate, getProjects } from '../utils';
import { notFound } from 'next/navigation';
import BackButton from '@/components/BackButton';

export async function generateStaticParams() {
const projectList = getProjects();
return projectList.map((project) => ({
slug: project.slug,
}));
}

export function generateMetadata({ params }) {
const project = getProjects().find((project) => project.slug === params.slug);
return {
title: project.metadata.title,
description: project.metadata.description,
};
}

export default function Page({ params }) {
const project = getProjects().find((project) => project.slug === params.slug);

if (!project) {
notFound();
}

return (
<main className="md:w-[40rem] w-full m-auto px-8 mt-32 flex flex-col gap-10 mb-20">
<div className="flex gap-4 items-center">
<BackButton />
<h1 className="text-3xl font-semibold">{project.metadata.title}</h1>
</div>
<article className="prose text-justify">
<CustomMDX source={project.content} />
</article>
</main>
);
}
14 changes: 14 additions & 0 deletions app/projects/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import ProjectSection from "@/components/ProjectSection";

export const metadata = {
title: "Projects",
};

export default async function Page() {
return (
<main className="md:w-[40rem] w-full m-auto px-8 mt-32 flex flex-col gap-10 mb-20">
<h1 className="text-3xl font-semibold">Projects</h1>
<ProjectSection />
</main>
);
}
55 changes: 55 additions & 0 deletions app/projects/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import fs from 'fs';
import path from 'path';
import { parseISO, format } from 'date-fns';

export function parseFrontmatter(fileContent) {
let frontmatterRegex = /---\s*([\s\S]*?)\s*---/;
let match = frontmatterRegex.exec(fileContent);
let frontMatterBlock = match[1];
let content = fileContent.replace(frontmatterRegex, '').trim();
let frontMatterLines = frontMatterBlock.trim().split('\n');
let metadata = {};

frontMatterLines.forEach((line) => {
let [key, ...valueArr] = line.split(': ');
let value = valueArr.join(': ').trim();
value = value.replace(/^['"](.*)['"]$/, '$1'); // Remove quotes
metadata[key.trim()] = value;
});

return { metadata, content };
}

function getMDXFiles(dir) {
return fs.readdirSync(dir).filter((file) => path.extname(file) === '.mdx');
}

function readMDXFile(filePath) {
let rawContent = fs.readFileSync(filePath, 'utf-8');
return parseFrontmatter(rawContent);
}

function getMDXData(dir) {
let mdxFiles = getMDXFiles(dir);
return mdxFiles.map((file) => {
let { metadata, content } = readMDXFile(path.join(dir, file));
let slug = path
.basename(file, path.extname(file))
.replace(/ /g, '')
.toLowerCase();

return {
metadata,
slug,
content,
};
});
}

export function getProjects() {
return getMDXData(path.join(process.cwd(), 'data', 'projects'));
}

export function formatDate(date) {
return format(parseISO(date), 'MMMM dd, yyyy');
}
16 changes: 16 additions & 0 deletions app/publications/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
import SelectedPublicationsSection from "@/components/Publications";
import bibtex from "@/data/bib/Publications.bib";

export const metadata = {
title: "Publications",
};

export default function Page() {
return (
<main className="md:w-[40rem] w-full m-auto px-8 mt-32 flex flex-col gap-10 mb-20">
<h1 className="text-3xl font-semibold">Publications</h1>
<SelectedPublicationsSection bibtex={bibtex} />
</main>
);
}
17 changes: 17 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": false,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/app/globals.css",
"baseColor": "neutral",
"cssVariables": false,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
Loading

0 comments on commit ec0be1c

Please sign in to comment.