Skip to content

Commit

Permalink
feat: add latest articles section
Browse files Browse the repository at this point in the history
  • Loading branch information
fbuireu committed Dec 21, 2023
1 parent 5c6f5b2 commit 1a4a316
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module.exports = {
rules: {
'react/prop-types': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-unused-vars': ['warn', {argsIgnorePattern: '^_'}],
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-restricted-imports': ['error'],
},
};
12 changes: 9 additions & 3 deletions src/ui/components/organisms/latestArticles/LatestArticles.astro
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const MAX_ARTICLES = 4;
const { limit = MAX_ARTICLES } = Astro.props as LatestArticlesProps;
const parser : MarkdownIt = MarkdownIt('default', {});
const parser: MarkdownIt = MarkdownIt('default', {});
const posts = await getCollection('articles');
posts.sort((a, b) => new Date(b.data.publishDate) - new Date(a.data.publishDate)).splice(limit);
---
Expand All @@ -39,7 +39,11 @@ posts.sort((a, b) => new Date(b.data.publishDate) - new Date(a.data.publishDate)
return (
<li class="latest__article__item__wrapper clickable">
<a class="latest__article__link-card" href={href} />
<article class={`latest__article__item ${variant === ArticleType.DEFAULT ? '--default-variant' : '--no-image-variant'}`}>
<article
class={`latest__article__item ${
variant === ArticleType.DEFAULT ? '--default-variant' : '--no-image-variant'
}`}
>
{data.featuredImage && (
<img
class="latest__article__item__featured-image"
Expand All @@ -53,7 +57,9 @@ posts.sort((a, b) => new Date(b.data.publishDate) - new Date(a.data.publishDate)
{publishedDate}
</time>
<h3 class="latest__article__title font-serif">{data.title}</h3>
<p class="latest__article__author">by <a href={`/tags/${slugify(data.author)}`}>{data.author}</a></p>
<p class="latest__article__author">
by <a href={`/tags/${slugify(data.author)}`}>{data.author}</a>
</p>
<p class="latest__article__excerpt">{excerpt}</p>
<ul class="latest__article__item__tags__list">
{data.tags?.map((tag) => (
Expand Down
3 changes: 2 additions & 1 deletion src/ui/components/organisms/siteHead/SiteHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props as
<script
type="text/partytown"
src=`https://www.googletagmanager.com/gtag/js?id=${import.meta.env.VITE_PUBLIC_GOOGLE_ANALYTICS_ID}`
></script>
>
</script>
<script type="text/partytown">
window.dataLayer = window.dataLayer || [];

Expand Down
40 changes: 10 additions & 30 deletions tsconfig.paths.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,16 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@ui/*": [
"./src/ui/*"
],
"@components/*": [
"./src/ui/components/*"
],
"@utils/*": [
"./src/utils/*"
],
"@assets/*": [
"./src/ui/assets/*"
],
"@styles/*": [
"./src/ui/styles/*"
],
"@shared/*": [
"./src/ui/shared/*"
],
"@articles/*": [
"./src/content//*"
],
"@i18n/*": [
"./src/i18n/*"
],
"@mocks/*": [
"./src/mocks/*"
],
"@types/*": [
"./src/types/*"
]
"@ui/*": ["./src/ui/*"],
"@components/*": ["./src/ui/components/*"],
"@utils/*": ["./src/utils/*"],
"@assets/*": ["./src/ui/assets/*"],
"@styles/*": ["./src/ui/styles/*"],
"@shared/*": ["./src/ui/shared/*"],
"@articles/*": ["./src/content//*"],
"@i18n/*": ["./src/i18n/*"],
"@mocks/*": ["./src/mocks/*"],
"@types/*": ["./src/types/*"]
}
}
}

0 comments on commit 1a4a316

Please sign in to comment.