-
Notifications
You must be signed in to change notification settings - Fork 9
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 #549 from appearhere/add-contenthub-card
LFR-3193: Add ContentHub Card
- Loading branch information
Showing
11 changed files
with
404 additions
and
3 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
143 changes: 143 additions & 0 deletions
143
packages/core/src/components/Cards/EditorialCard/ContentHubCard.css
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,143 @@ | ||
.root { | ||
display: flex; | ||
width: 100%; | ||
font-family: var(--font-avenir); | ||
box-sizing: border-box; | ||
height: 100%; | ||
background: var(--color-white); | ||
} | ||
|
||
.root:after { | ||
content: ''; | ||
position: absolute; | ||
z-index: 0; | ||
width: 100%; | ||
height: 100%; | ||
opacity: 0; | ||
top: 0; | ||
left: 0; | ||
transition: opacity 200ms ease-in-out; | ||
z-index: -1; | ||
box-shadow: 0px 0px 5px 0px rgb(216,216,216,1), 0px 0px 15px 0px rgb(0,0,0,0.25); | ||
} | ||
|
||
.root:focus { | ||
border: 2px solid var(--color-greyLighter); | ||
box-sizing: content-box; | ||
margin: -2px; | ||
} | ||
|
||
.imageContainer, .content { | ||
vertical-align: top; | ||
} | ||
|
||
.imageContainer { | ||
width: 40%; | ||
} | ||
|
||
.image { | ||
width: 100%; | ||
height: 100%; | ||
object-fit: cover; | ||
} | ||
|
||
.content { | ||
width: 60%; | ||
padding: 1rem; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.categoryContainer { | ||
display: flex; | ||
font-style: normal; | ||
font-weight: var(--fontweight-regular); | ||
font-size: var(--fontsize-small-i); | ||
line-height: var(--lineheight-large-i); | ||
} | ||
|
||
.category { | ||
color: var(--color-gold); | ||
margin-right: 0.5rem; | ||
text-decoration-line: underline; | ||
} | ||
|
||
.date { | ||
color: var(--color-black); | ||
margin-left: 0.5rem; | ||
} | ||
|
||
.title { | ||
margin-block-end: 0rem; | ||
margin-block-start: 0.5rem; | ||
} | ||
|
||
.titleLink { | ||
color: var(--color-black); | ||
font-style: normal; | ||
font-weight: var(--fontweight-demi); | ||
font-size: var(--fontsize-large-i); | ||
line-height: var(--fontsize-large-iii); | ||
text-transform: none; | ||
margin-top: 0.5rem; | ||
width: 100%; | ||
text-decoration: none; | ||
} | ||
|
||
.titleLink:after { | ||
content: ''; | ||
position: absolute; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.description { | ||
font-size: var(--fontsize-small-i); | ||
color: var(--color-greyDark); | ||
margin: 0.25rem 0 0 0; | ||
} | ||
|
||
.chipContainer { | ||
margin-top: 1rem; | ||
position: relative; | ||
} | ||
|
||
.btn { | ||
margin-top: 1rem; | ||
width: fit-content; | ||
position: relative; | ||
} | ||
|
||
@media(hover) { | ||
.root:hover:after { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@media (max-width: 23.125rem) { | ||
.root { | ||
flex-direction: column; | ||
} | ||
|
||
.imageContainer { | ||
width: 100%; | ||
} | ||
|
||
.image { | ||
width: 100%; | ||
height: auto; | ||
max-width: 23.125rem; | ||
max-height: 15rem; | ||
} | ||
|
||
.content { | ||
width: 100%; | ||
} | ||
|
||
.titleLink { | ||
font-size: var(--font-large-ii); | ||
line-height: var(--lineheight-large-i); | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
packages/core/src/components/Cards/EditorialCard/ContentHubCard.js
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,78 @@ | ||
// @flow | ||
import * as React from 'react'; | ||
|
||
import Card from '../Card/Card'; | ||
import css from './ContentHubCard.css'; | ||
import FittedImage from '../../FittedImage/FittedImage'; | ||
import ChipGroup from '../../ChipGroup/ChipGroup'; | ||
import Btn from '../../Btn/Btn'; | ||
import cx from 'classnames'; | ||
|
||
type Tag = { | ||
href: string, | ||
name: string, | ||
} | ||
|
||
type Props = { | ||
description?: string, | ||
category?: string, | ||
date?: string, | ||
cta?: string, | ||
tags?: Array<Tag>, | ||
src: string, | ||
title: string, | ||
href: string, | ||
onButtonClick?: Function, | ||
className?: string, | ||
}; | ||
|
||
const ContentHubCard = ({ | ||
description, | ||
category, | ||
date, | ||
cta, | ||
tags, | ||
src, | ||
title, | ||
href, | ||
onButtonClick, | ||
className, | ||
}: Props) => { | ||
|
||
const handleButtonClick = e => { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
onButtonClick && onButtonClick(); | ||
}; | ||
|
||
const classes = cx(className, css.root); | ||
|
||
return ( | ||
<Card className={classes}> | ||
<div className={css.imageContainer}> | ||
<FittedImage src={src} alt={title} className={css.image} /> | ||
</div> | ||
<div className={css.content}> | ||
<div className={css.categoryContainer}> | ||
<span className={css.category}>{category}</span> | ||
{date && category && ' · '} | ||
<span className={css.date}>{date}</span> | ||
</div> | ||
<h3 className={css.title}><a href={href} className={css.titleLink}>{title}</a></h3> | ||
<p className={css.description}>{description}</p> | ||
{ tags && <ChipGroup tags={tags} className={css.chipContainer} />} | ||
{cta && | ||
<Btn | ||
className={css.btn} | ||
context="primary" | ||
onClick={handleButtonClick} | ||
> | ||
{cta} | ||
</Btn> | ||
} | ||
</div> | ||
</Card> | ||
); | ||
} | ||
|
||
export default ContentHubCard; |
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,8 @@ | ||
.root { | ||
display: block; | ||
} | ||
|
||
.chip { | ||
margin-right: 1px; | ||
margin-bottom: 1px; | ||
} |
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,31 @@ | ||
// @flow | ||
|
||
import * as React from 'react'; | ||
import cx from 'classnames'; | ||
import css from './ChipGroup.css'; | ||
import Chip from '../Chip/Chip'; | ||
|
||
type Tag = { | ||
href: string, | ||
name: string, | ||
} | ||
|
||
type Props = { | ||
tags: Array<Tag>, | ||
className?: string, | ||
}; | ||
|
||
const ChipGroup = ({ className, tags }: Props) => ( | ||
<div className={cx(className, css.root)}> | ||
{tags && tags.map((tag) => ( | ||
<Chip | ||
href={tag.href} | ||
text={tag.name} | ||
className={css.chip} | ||
/> | ||
))} | ||
</div> | ||
); | ||
|
||
export default ChipGroup; | ||
|
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,47 @@ | ||
@font-face{ | ||
font-family:"Avenir Next W01"; | ||
font-display: swap; | ||
src: url("https://cdn-1.ah-assets.net/uploads/fonts/web/17c55b27-e9ab-43cd-b948-d49f97480d68.eot?#iefix"); | ||
src: url("https://cdn-1.ah-assets.net/uploads/fonts/web/17c55b27-e9ab-43cd-b948-d49f97480d68.eot?#iefix") format("eot"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/2e3f5cb9-101f-46cf-a7b3-dfaa58261e03.woff2") format("woff2"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/fa19948e-5e38-4909-b31e-41acd170d6f2.woff") format("woff"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/6de0ce4d-9278-467b-b96f-c1f5f0a4c375.ttf") format("truetype"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/9fd4ea0c-b19a-4b21-9fdf-37045707dd78.svg#9fd4ea0c-b19a-4b21-9fdf-37045707dd78") format("svg"); | ||
font-weight: 300; | ||
font-style: normal; | ||
} | ||
@font-face{ | ||
font-family:"Avenir Next W01"; | ||
font-display: swap; | ||
src:url("https://cdn-1.ah-assets.net/uploads/fonts/web/e9167238-3b3f-4813-a04a-a384394eed42.eot?#iefix"); | ||
src:url("https://cdn-1.ah-assets.net/uploads/fonts/web/e9167238-3b3f-4813-a04a-a384394eed42.eot?#iefix") format("eot"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/2cd55546-ec00-4af9-aeca-4a3cd186da53.woff2") format("woff2"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/1e9892c0-6927-4412-9874-1b82801ba47a.woff") format("woff"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/46cf1067-688d-4aab-b0f7-bd942af6efd8.ttf") format("truetype"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/52a192b1-bea5-4b48-879f-107f009b666f.svg#52a192b1-bea5-4b48-879f-107f009b666f") format("svg"); | ||
font-weight: 400; | ||
font-style: normal; | ||
} | ||
@font-face{ | ||
font-family:"Avenir Next W01"; | ||
font-display: swap; | ||
src:url("https://cdn-1.ah-assets.net/uploads/fonts/web/12d643f2-3899-49d5-a85b-ff430f5fad15.eot?#iefix"); | ||
src:url("https://cdn-1.ah-assets.net/uploads/fonts/web/12d643f2-3899-49d5-a85b-ff430f5fad15.eot?#iefix") format("eot"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/aad99a1f-7917-4dd6-bbb5-b07cedbff64f.woff2") format("woff2"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/91b50bbb-9aa1-4d54-9159-ec6f19d14a7c.woff") format("woff"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/a0f4c2f9-8a42-4786-ad00-fce42b57b148.ttf") format("truetype"), | ||
url("https://cdn-1.ah-assets.net/uploads/fonts/web/99affa9a-a5e9-4559-bd07-20cf0071852d.svg#99affa9a-a5e9-4559-bd07-20cf0071852d") format("svg"); | ||
font-weight: 700; | ||
font-style: normal; | ||
} | ||
@font-face{ | ||
font-family:"Avenir Next W01"; | ||
font-display: swap; | ||
src:url("https://cdn-1.ah-assets.net/uploads/fonts/web/dccb10af-07a2-404c-bfc7-7750e2716bc1.eot?#iefix"); | ||
src:url("https://cdn-1.ah-assets.net/uploads/fonts/web/dccb10af-07a2-404c-bfc7-7750e2716bc1.eot?#iefix") format("eot"), | ||
url("https://cdn-1.ah-assets.net/uploads/uploads/fonts/web/14c73713-e4df-4dba-933b-057feeac8dd1.woff2") format("woff2"),url("https://cdn-1.ah-assets.net/uploads/uploads/fonts/web/b8e906a1-f5e8-4bf1-8e80-82c646ca4d5f.woff") format("woff"), | ||
url("https://cdn-1.ah-assets.net/uploads/uploads/fonts/web/890bd988-5306-43ff-bd4b-922bc5ebdeb4.ttf") format("truetype"), | ||
url("https://cdn-1.ah-assets.net/uploads/uploads/fonts/web/ed104d8c-7f39-4e8b-90a9-4076be06b857.svg#ed104d8c-7f39-4e8b-90a9-4076be06b857") format("svg"); | ||
font-weight: 800; | ||
font-style: normal; | ||
} |
Oops, something went wrong.
e51cd04
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: