-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from comicrelief/feature/32_article_teaser_mol…
…ecule Article Teaser Molecule
- Loading branch information
Showing
12 changed files
with
345 additions
and
30 deletions.
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
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
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
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,89 @@ | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import Text from '../../Atoms/Text/Text'; | ||
import Picture from '../../Atoms/Picture/Picture'; | ||
import StyledLink from '../../Atoms/Link/Link.style'; | ||
|
||
/** | ||
* Article tag wrapper | ||
*/ | ||
const Wrapper = styled.article` | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
background-color: #fff; | ||
`; | ||
|
||
const Link = styled(StyledLink)` | ||
display: flex; | ||
height: 100%; | ||
border: 0; | ||
flex-direction: column; | ||
@media ${({ theme }) => theme.breakpoint('small')} { | ||
flex-direction: row; | ||
} | ||
@media ${({ theme }) => theme.breakpoint('large')} { | ||
flex-direction: column; | ||
} | ||
`; | ||
|
||
const ImageWrapper = styled.div` | ||
height: 100%; | ||
@media ${({ theme }) => theme.breakpoint('small')} { | ||
width: 45%; | ||
} | ||
@media ${({ theme }) => theme.breakpoint('large')} { | ||
width: 100%; | ||
} | ||
`; | ||
|
||
const CopyWrapper = styled.div` | ||
padding: 40px; | ||
h3 { | ||
margin: 0; | ||
} | ||
@media ${({ theme }) => theme.breakpoint('small')} { | ||
width: 55%; | ||
} | ||
@media ${({ theme }) => theme.breakpoint('large')} { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
`; | ||
|
||
/** | ||
* Article teaser component | ||
*/ | ||
const ArticleTeaser = ({ date, href, images, alt, title }) => { | ||
return ( | ||
<Wrapper> | ||
<Link href={href} inline> | ||
<ImageWrapper> | ||
<Picture images={images} alt={alt} objectFit="cover" /> | ||
</ImageWrapper> | ||
<CopyWrapper> | ||
<Text size="xxs" weight="bold" uppercase> | ||
{date} | ||
</Text> | ||
<Text size="xl" tag="h3" uppercase> | ||
{title} | ||
</Text> | ||
</CopyWrapper> | ||
</Link> | ||
</Wrapper> | ||
); | ||
}; | ||
|
||
ArticleTeaser.propTypes = { | ||
// eslint-disable-next-line react/forbid-prop-types | ||
images: PropTypes.object.isRequired, | ||
alt: PropTypes.string.isRequired, | ||
date: PropTypes.string.isRequired, | ||
title: PropTypes.string.isRequired, | ||
/** link url */ | ||
href: PropTypes.string.isRequired | ||
}; | ||
|
||
export default ArticleTeaser; |
Oops, something went wrong.