Skip to content

Commit

Permalink
feat: add cover to article
Browse files Browse the repository at this point in the history
  • Loading branch information
fpasquet committed Jan 29, 2024
1 parent d0bd314 commit 2bc6a65
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 32 deletions.
21 changes: 4 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"node": ">= 20.0"
},
"dependencies": {
"@eleven-labs/design-system": "^0.24.0",
"@eleven-labs/design-system": "^0.26.2",
"@remix-run/router": "^1.7.2",
"algoliasearch": "^4.19.1",
"classnames": "^2.3.2",
Expand Down
Binary file added src/assets/imgs/cover-article.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions src/containers/AuthorPageContainer/useAuthorPageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useLoaderData, useParams } from 'react-router-dom';
import { blogUrl } from '@/config/website';
import { DEFAULT_LANGUAGE, PATHS } from '@/constants';
import { PostCardListContainer, PostCardListContainerProps } from '@/containers/PostCardListContainer';
import { getPathFile } from '@/helpers/assetHelper';
import { generatePath } from '@/helpers/routerHelper';
import { useNewsletterCard } from '@/hooks/useNewsletterCard';
import { useTitle } from '@/hooks/useTitle';
Expand Down Expand Up @@ -65,7 +64,6 @@ export const useAuthorPageContainer = (): AuthorPageProps | undefined => {
}),
content: <div dangerouslySetInnerHTML={{ __html: author.content }} />,
},
emptyAvatarImageUrl: getPathFile('/imgs/astronaut.png'),
title: t('pages.author.post_list_title'),
postCardList: (
<PostCardListContainer
Expand Down
22 changes: 12 additions & 10 deletions src/containers/HomePageContainer/useHomePageContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,18 @@ export const useHomePageContainer = (): HomePageProps => {
href: generatePath(PATHS.CATEGORY, { categoryName: 'all', lang: i18n.language }),
},
},
lastTutorialsBlock: {
title: <TransWithHtml i18nKey="pages.home.last-tutorials-block.title" onlyLineBreak />,
description: <TransWithHtml i18nKey="pages.home.last-tutorials-block.description" />,
tutorialLabel: t('common.tutorial-tag'),
posts: lastTutorialsForCardList,
linkSeeMore: {
label: t('pages.home.last-tutorials-block.link-see-more'),
href: generatePath(PATHS.CATEGORY, { categoryName: ContentTypeEnum.TUTORIAL, lang: i18n.language }),
},
},
lastTutorialsBlock: lastTutorialsForCardList.length
? {
title: <TransWithHtml i18nKey="pages.home.last-tutorials-block.title" onlyLineBreak />,
description: <TransWithHtml i18nKey="pages.home.last-tutorials-block.description" />,
tutorialLabel: t('common.tutorial-tag'),
posts: lastTutorialsForCardList,
linkSeeMore: {
label: t('pages.home.last-tutorials-block.link-see-more'),
href: generatePath(PATHS.CATEGORY, { categoryName: ContentTypeEnum.TUTORIAL, lang: i18n.language }),
},
}
: undefined,
newsletterCard,
};
};
7 changes: 5 additions & 2 deletions src/hooks/usePostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';

import { PATHS } from '@/constants';
import { getPathFile } from '@/helpers/assetHelper';
import { generatePath } from '@/helpers/routerHelper';
import { useBreadcrumb } from '@/hooks/useBreadcrumb';
import { useContactCard } from '@/hooks/useContactCard';
Expand Down Expand Up @@ -40,6 +41,10 @@ export const usePostPage = (post: PostPageData): Omit<PostPageProps, 'variant' |

return {
breadcrumb,
cover: {
src: getPathFile('/imgs/cover-article.jpg'),
alt: 'cover',
},
header: {
title: post.title,
date: getDateToString({ date: post.date }),
Expand All @@ -48,12 +53,10 @@ export const usePostPage = (post: PostPageData): Omit<PostPageProps, 'variant' |
shareLinks: {
urlToShare: typeof window !== 'undefined' ? window.location.href : '',
shares: {
copyLink: true,
twitter: true,
facebook: true,
linkedIn: true,
},
copiedLabel: t('common.post.share_links.copied_label'),
},
},
footer: {
Expand Down
5 changes: 5 additions & 0 deletions src/hooks/usePostsForCardList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { PostCardListProps } from '@eleven-labs/design-system';
import { useTranslation } from 'react-i18next';

import { PATHS } from '@/constants';
import { getPathFile } from '@/helpers/assetHelper';
import { generatePath } from '@/helpers/routerHelper';
import { truncateText } from '@/helpers/stringHelper';
import { useDateToString } from '@/hooks/useDateToString';
Expand All @@ -20,6 +21,10 @@ export const usePostsForCardList = (options: {
: (options.posts ?? []).map((post) => ({
contentType: post.contentType,
slug: post.slug,
cover: {
src: getPathFile('/imgs/cover-article.jpg'),
alt: 'cover',
},
title: post.title,
excerpt: truncateText(post.excerpt, 125),
date: getDateToString({ date: post.date }),
Expand Down

0 comments on commit 2bc6a65

Please sign in to comment.