summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/ProjectSummary/ProjectSummary.tsx10
m---------src/content0
-rw-r--r--src/pages/projet/[slug].tsx8
-rw-r--r--src/ts/types/app.ts21
4 files changed, 20 insertions, 19 deletions
diff --git a/src/components/ProjectSummary/ProjectSummary.tsx b/src/components/ProjectSummary/ProjectSummary.tsx
index 1b07eb1..b32c11f 100644
--- a/src/components/ProjectSummary/ProjectSummary.tsx
+++ b/src/components/ProjectSummary/ProjectSummary.tsx
@@ -11,25 +11,25 @@ import { useRouter } from 'next/router';
import styles from './ProjectSummary.module.scss';
const ProjectSummary = ({
+ id,
title,
- cover,
meta,
}: {
+ id: string;
title: string;
- cover: string;
meta: ProjectMeta;
}) => {
- const { license, repos, technologies } = meta;
+ const { hasCover, license, repos, technologies } = meta;
const router = useRouter();
const locale = router.locale ? router.locale : config.locales.defaultLocale;
const { data } = useGithubApi(repos?.github ? repos.github : '');
return (
<div className={styles.wrapper}>
- {cover && (
+ {hasCover && (
<div className={styles.cover}>
<Image
- src={cover}
+ src={`/projects/${id}.jpg`}
alt={t`${title} preview`}
layout="fill"
objectFit="contain"
diff --git a/src/content b/src/content
-Subproject 1dc7705299e9e4a05ecddd35dd1357d6426efe0
+Subproject c85ab7210b3fc984bc06e2d672839cedc37344e
diff --git a/src/pages/projet/[slug].tsx b/src/pages/projet/[slug].tsx
index 7ae50d6..b6a9cf2 100644
--- a/src/pages/projet/[slug].tsx
+++ b/src/pages/projet/[slug].tsx
@@ -31,7 +31,7 @@ const Project: NextPageWithLayout<ProjectProps> = ({
}) => {
const router = useRouter();
const projectUrl = `${config.url}${router.asPath}`;
- const { cover, id, intro, meta, title, seo } = project;
+ const { id, intro, meta, title, seo } = project;
const dates = {
publication: meta.publishedOn,
update: meta.updatedOn,
@@ -76,8 +76,8 @@ const Project: NextPageWithLayout<ProjectProps> = ({
dateModified: updateDate.toISOString(),
datePublished: publicationDate.toISOString(),
editor: { '@id': `${config.url}/#branding` },
- thumbnailUrl: cover,
- image: cover,
+ thumbnailUrl: meta.hasCover ? `/projects/${id}.jpg` : '',
+ image: meta.hasCover ? `/projects/${id}.jpg` : '',
inLanguage: config.locales.defaultLocale,
license: 'https://creativecommons.org/licenses/by-sa/4.0/deed.fr',
mainEntityOfPage: { '@id': `${projectUrl}` },
@@ -111,7 +111,7 @@ const Project: NextPageWithLayout<ProjectProps> = ({
<ToC />
</Sidebar>
<div className={styles.body}>
- <ProjectSummary title={title} cover={cover} meta={meta} />
+ <ProjectSummary id={id} title={title} meta={meta} />
<ProjectContent components={components} />
</div>
<Sidebar position="right">
diff --git a/src/ts/types/app.ts b/src/ts/types/app.ts
index ddd64d1..636aeed 100644
--- a/src/ts/types/app.ts
+++ b/src/ts/types/app.ts
@@ -94,15 +94,6 @@ export type Meta = {
updatedOn: string;
};
-export type ProjectMeta = Omit<Meta, 'title'> & {
- license: string;
- repos?: {
- github?: string;
- gitlab?: string;
- };
- technologies?: string[];
-};
-
export type PageInfo = {
endCursor: string;
hasNextPage: boolean;
@@ -110,7 +101,7 @@ export type PageInfo = {
};
export type Project = {
- cover: string;
+ cover?: string;
id: string;
intro: string;
meta: ProjectMeta;
@@ -123,6 +114,16 @@ export type Project = {
};
};
+export type ProjectMeta = Omit<Meta, 'title'> & {
+ hasCover: boolean;
+ license: string;
+ repos?: {
+ github?: string;
+ gitlab?: string;
+ };
+ technologies?: string[];
+};
+
export type ProjectProps = {
project: Project;
};