From f5ba1046b13acd239c472e361f345902937662fb Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Thu, 20 Jan 2022 11:57:16 +0100
Subject: chore: add a page for projects

---
 src/components/ProjectPreview/ProjectPreview.tsx | 55 ++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 src/components/ProjectPreview/ProjectPreview.tsx

(limited to 'src/components/ProjectPreview/ProjectPreview.tsx')

diff --git a/src/components/ProjectPreview/ProjectPreview.tsx b/src/components/ProjectPreview/ProjectPreview.tsx
new file mode 100644
index 0000000..91969b0
--- /dev/null
+++ b/src/components/ProjectPreview/ProjectPreview.tsx
@@ -0,0 +1,55 @@
+import { t } from '@lingui/macro';
+import { Project } from '@ts/types/app';
+import { slugify } from '@utils/helpers/slugify';
+import Image from 'next/image';
+import Link from 'next/link';
+import styles from './ProjectPreview.module.scss';
+
+const ProjectPreview = ({ project }: { project: Project }) => {
+  return (
+    <Link href={`/projet/${project.slug}`}>
+      <a className={styles.link}>
+        <article className={styles.article}>
+          <header>
+            {project.cover && (
+              <div className={styles.cover}>
+                <Image
+                  src={project.cover}
+                  layout="fill"
+                  objectFit="contain"
+                  objectPosition="center"
+                  alt={`${project.meta.title} picture`}
+                />
+              </div>
+            )}
+            <h2 className={styles.title}>{project.meta.title}</h2>
+          </header>
+          <div
+            className={styles.body}
+            dangerouslySetInnerHTML={{ __html: project.intro }}
+          ></div>
+          <footer>
+            <dl className={styles.meta}>
+              {project.meta.license && (
+                <div className={styles.meta__item}>
+                  <dt>{t`License:`}</dt>
+                  <dd>{project.meta.license}</dd>
+                </div>
+              )}
+              {project.meta.technologies && (
+                <div className={styles.meta__item}>
+                  <dt>{t`Technologies:`}</dt>
+                  {project.meta.technologies.map((techno) => (
+                    <dd key={slugify(techno)}>{techno}</dd>
+                  ))}
+                </div>
+              )}
+            </dl>
+          </footer>
+        </article>
+      </a>
+    </Link>
+  );
+};
+
+export default ProjectPreview;
-- 
cgit v1.2.3

