This repository was archived by the owner on May 20, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 183
Sean/add all articles page #1839
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
79ce9c5
add all articles page
seanho96 224743b
update breakpoints
seanho96 e410012
fix: merge conflict
seanho96 f71d68f
replace with new colors
seanho96 9b80984
hide categories when length is more than 2
seanho96 9ef0d45
update title and description of page
seanho96 5b9c89c
redirect to slug link upon card click
seanho96 81cc4b3
apply code suggestions
seanho96 83021f1
apply code suggestions
seanho96 1cbafdf
update breakpoints
seanho96 4085e7e
Merge branch 'master' of github.com:binary-com/deriv-com into sean/al…
seanho96 c179507
update new header types & remove localization
seanho96 bc3a9dd
Merge branch 'master' of github.com:binary-com/deriv-com into sean/al…
seanho96 972a15b
update banner responsive height
seanho96 518cafc
fix: card heights on safari
seanho96 4c1444a
fix: card and container max-widths
seanho96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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 hidden or 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,65 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import styled from 'styled-components' | ||
import ArticleCard from './_article-card' | ||
import FeaturedArticle from './_featured-article' | ||
import { Flex } from 'components/containers' | ||
import { Text, LocalizedLinkText } from 'components/elements' | ||
import device from 'themes/device' | ||
import RightArrow from 'images/svg/black-right-arrow.svg' | ||
|
||
const VideoGrid = styled.div` | ||
display: grid; | ||
width: 100%; | ||
height: 100%; | ||
margin: 40px 0; | ||
grid-template-columns: repeat(auto-fit, minmax(288px, 384px)); | ||
grid-row-gap: 40px; | ||
grid-column-gap: 24px; | ||
grid-template-rows: auto; | ||
` | ||
|
||
const Container = styled(Flex)` | ||
width: 90%; | ||
max-width: 1200px; | ||
|
||
@media ${device.desktopL} { | ||
max-width: 1600px; | ||
} | ||
@media ${device.tabletL} { | ||
width: 100%; | ||
padding: 0 16px; | ||
} | ||
` | ||
|
||
const AllArticles = ({ article_data }) => { | ||
return ( | ||
<Container m="0 auto" fd="column" ai="center"> | ||
<Flex jc="flex-start" ai="center" mt="40px"> | ||
<LocalizedLinkText to="/blog/" color="grey-5"> | ||
Home | ||
</LocalizedLinkText> | ||
<img | ||
src={RightArrow} | ||
alt="Right arrow" | ||
height="16" | ||
width="16" | ||
style={{ margin: '0 8px' }} | ||
/> | ||
<Text>All articles</Text> | ||
</Flex> | ||
<FeaturedArticle article_data={article_data} /> | ||
<VideoGrid style={{ justifyContent: 'center' }}> | ||
{article_data.map((item) => { | ||
return <ArticleCard key={item.id} item={item} /> | ||
})} | ||
</VideoGrid> | ||
</Container> | ||
) | ||
} | ||
|
||
AllArticles.propTypes = { | ||
article_data: PropTypes.arrayOf(PropTypes.object), | ||
} | ||
|
||
export default AllArticles |
This file contains hidden or 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,112 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
import styled from 'styled-components' | ||
import { Flex } from 'components/containers' | ||
import { Header } from 'components/elements' | ||
import { LocalizedLink } from 'components/localization' | ||
import device from 'themes/device' | ||
|
||
const ArticleCardWrapper = styled(Flex)` | ||
max-width: 384px; | ||
flex-direction: column; | ||
justify-content: flex-start; | ||
text-decoration: none; | ||
position: relative; | ||
height: 100%; | ||
border-radius: 8px; | ||
border: 1px solid var(--color-grey-8); | ||
background: var(--color-white); | ||
transition: transform 0.3s; | ||
overflow: hidden; | ||
cursor: pointer; | ||
|
||
&:hover { | ||
transform: translateY(-1.1rem) scale(1.02); | ||
} | ||
` | ||
|
||
const ImageWrapper = styled.div` | ||
height: 200px; | ||
width: 384px; | ||
position: relative; | ||
z-index: 1; | ||
overflow: hidden; | ||
|
||
@media ${device.mobileL} { | ||
width: 100%; | ||
height: 184px; | ||
} | ||
` | ||
|
||
const StyledCategories = styled(Header)` | ||
width: fit-content; | ||
border-radius: 8px; | ||
background-color: var(--color-blue-10); | ||
color: var(--color-blue-9); | ||
padding: 2px 8px 0; | ||
margin: 0 8px 8px 0; | ||
` | ||
|
||
const ContentWrapper = styled.div` | ||
padding: 16px 24px; | ||
This conversation was marked as resolved.
Show resolved
Hide resolved
|
||
|
||
@media ${device.mobileL} { | ||
padding: 16px; | ||
} | ||
` | ||
|
||
const RedirectLink = styled(LocalizedLink)` | ||
text-decoration: none; | ||
` | ||
|
||
const ArticleCard = ({ item }) => { | ||
return ( | ||
<RedirectLink to={`/blog/articles/${item.slug}`}> | ||
<ArticleCardWrapper> | ||
<ImageWrapper> | ||
<img | ||
src={item.image} | ||
alt="Video card" | ||
width="100%" | ||
style={{ objectFit: 'contain' }} | ||
/> | ||
</ImageWrapper> | ||
<ContentWrapper> | ||
<Flex jc="flex-start" height="auto" fw="wrap"> | ||
{item.category.slice(0, 2).map((item_category) => ( | ||
<StyledCategories as="h4" type="paragraph-2" key={item_category}> | ||
{item_category} | ||
</StyledCategories> | ||
))} | ||
{item.category.length > 2 && ( | ||
<StyledCategories as="h4" type="paragraph-2"> | ||
{`+${item.category.slice(2).length.toString()}`} | ||
</StyledCategories> | ||
)} | ||
<Header | ||
as="h5" | ||
type="paragraph-2" | ||
weight="normal" | ||
color="grey-5" | ||
width="auto" | ||
> | ||
{`• ${item.reading_time} min read`} | ||
</Header> | ||
</Flex> | ||
<Header as="h3" type="subtitle-2"> | ||
{item.title} | ||
</Header> | ||
<Header as="p" type="paragraph-2" weight="normal" mt="8px" color="grey-5"> | ||
{item.description} | ||
</Header> | ||
</ContentWrapper> | ||
</ArticleCardWrapper> | ||
</RedirectLink> | ||
) | ||
} | ||
|
||
ArticleCard.propTypes = { | ||
item: PropTypes.arrayOf(PropTypes.object), | ||
} | ||
|
||
export default ArticleCard |
This file contains hidden or 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,101 @@ | ||
export const article_data = [ | ||
{ | ||
image: 'https://source.unsplash.com/random/1', | ||
reading_time: '2', | ||
category: ['Multipliers', 'CFD', 'Stocks', 'Forex', 'Category'], | ||
title: 'How to trade multipliers on Deriv', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 1, | ||
}, | ||
{ | ||
image: 'https://source.unsplash.com/random/2', | ||
reading_time: '2', | ||
category: ['Multipliers'], | ||
title: 'How to trade multipliers on Deriv this is for really long titles', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 2, | ||
}, | ||
{ | ||
image: 'https://source.unsplash.com/random/3', | ||
reading_time: '2', | ||
category: ['Multipliers'], | ||
title: 'How to trade multipliers on Deriv', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com. This has an extra extra long section of the description for testing purposes.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 3, | ||
}, | ||
{ | ||
image: 'https://source.unsplash.com/random/4', | ||
reading_time: '2', | ||
category: ['Multipliers'], | ||
title: 'How to trade multipliers on Deriv', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 4, | ||
}, | ||
{ | ||
image: 'https://source.unsplash.com/random/5', | ||
reading_time: '2', | ||
category: ['Multipliers'], | ||
title: 'How to trade multipliers on Deriv', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 5, | ||
}, | ||
{ | ||
image: 'https://source.unsplash.com/random/6', | ||
reading_time: '2', | ||
category: ['Multipliers'], | ||
title: 'How to trade multipliers on Deriv', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 6, | ||
}, | ||
{ | ||
image: 'https://source.unsplash.com/random/7', | ||
reading_time: '2', | ||
category: ['Multipliers'], | ||
title: 'How to trade multipliers on Deriv', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 7, | ||
}, | ||
{ | ||
image: 'https://source.unsplash.com/random/8', | ||
reading_time: '2', | ||
category: ['Multipliers'], | ||
title: 'How to trade multipliers on Deriv', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 8, | ||
}, | ||
{ | ||
image: 'https://source.unsplash.com/random/9', | ||
reading_time: '2', | ||
category: ['Multipliers'], | ||
title: 'How to trade multipliers on Deriv', | ||
description: | ||
'To help you begin, we will look at the basics of cryptocurrency: what it is, how it works, and how to start trading cryptos on Deriv.com.', | ||
date: '12 June 2021', | ||
slug: 'how-to-trade-multipliers-on-deriv', | ||
id: 9, | ||
}, | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.