This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fe97eb
commit a4f192c
Showing
4 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React from 'react' | ||
import moment from 'moment' | ||
import * as styles from '../posts.module.scss' | ||
import Layout from 'features/components/templates/layout' | ||
import Typography from 'features/components/atoms/typography' | ||
import { Localize } from 'components/localization' | ||
import Flex from 'features/components/atoms/flex-box' | ||
import Link from 'features/components/atoms/link' | ||
import dclsx from 'features/utils/dclsx' | ||
|
||
const AllPostsModule = ({ data }: TBlogPosts) => { | ||
const posts = data?.allStrapiPost?.nodes || [] | ||
return ( | ||
<Layout> | ||
<Flex.Box margin_block="12x" direction="col" className={styles.posts_wrapper}> | ||
<Typography.Heading as="h2" size="small"> | ||
<Localize | ||
translate_text={'_t_Trading articles: read and learn how to trade_t_'} | ||
/> | ||
</Typography.Heading> | ||
|
||
<Flex.Box wrap="wrap" margin_block="15x" justify="around"> | ||
{posts?.map(({ hero }) => { | ||
const { title, banner, date } = hero | ||
const parsedDate = moment(date) | ||
const formattedDate = parsedDate?.format('Do [of] MMMM YYYY') | ||
return ( | ||
<Flex.Box direction="col" key={title} className={styles.image_wrapper}> | ||
<Link url={{ type: 'internal', to: '/' }} no_hover> | ||
<img | ||
src={banner?.localFile?.publicURL} | ||
className={styles.post_image} | ||
/> | ||
</Link> | ||
<div className={dclsx('margin-block-10x')}> | ||
<Link url={{ type: 'internal', to: '/' }} no_hover> | ||
<Typography.Heading as="h3" size="xxs"> | ||
<Localize translate_text={`_t_${title}_t_`} /> | ||
</Typography.Heading> | ||
</Link> | ||
<div | ||
className={dclsx( | ||
'text-medium', | ||
'typography-color-gray-shade', | ||
)} | ||
> | ||
{formattedDate || ''} | ||
</div> | ||
</div> | ||
</Flex.Box> | ||
) | ||
})} | ||
</Flex.Box> | ||
</Flex.Box> | ||
</Layout> | ||
) | ||
} | ||
|
||
export default AllPostsModule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react' | ||
import { graphql } from 'gatsby' | ||
import { TGatsbyHead } from 'features/types' | ||
import { SEO } from 'components/containers' | ||
import { WithIntl } from 'components/localization' | ||
import AllPostsModule from 'features/pages/posts/all-posts' | ||
|
||
const BlogPosts = ({ data }: TBlogPosts) => { | ||
return <AllPostsModule data={data} /> | ||
} | ||
|
||
export default WithIntl()(BlogPosts) | ||
|
||
export const query = graphql` | ||
query { | ||
allStrapiPost(sort: { fields: createdAt, order: DESC }) { | ||
nodes { | ||
createdAt | ||
hero { | ||
title | ||
date | ||
tags | ||
banner { | ||
localFile { | ||
publicURL | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
` | ||
|
||
export const Head = ({ pageContext }: TGatsbyHead) => ( | ||
<SEO title="_t__t_" description="_t_._t_" pageContext={pageContext} /> | ||
) |