-
-
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.
created fullarticleheader & helmetfullarticle
- Loading branch information
Showing
10 changed files
with
375 additions
and
4,780 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,76 @@ | ||
import React, { useState } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import { motion, AnimatePresence } from 'framer-motion'; | ||
import { IoMdClose } from 'react-icons/io'; | ||
import { BsArrowLeft } from 'react-icons/bs'; | ||
import { urlFor } from '../../client'; | ||
import BlockContent from '@sanity/block-content-to-react'; | ||
import './FullArticle.css'; | ||
|
||
const FullArticleHeader = ({ | ||
headerImage, | ||
headerDataColor, | ||
headerImageAlt, | ||
author, | ||
arrowColor, | ||
titleColor, | ||
titleFilter, | ||
title, | ||
publishedAt, | ||
categories, | ||
}) => { | ||
const [showDetails, setShowDetails] = useState(false); | ||
|
||
return ( | ||
<div className="ct__full-article__header"> | ||
{headerImage && headerImage.asset && <img src={urlFor(headerImage.asset).url()} alt={headerImageAlt} />} | ||
<Link className="ct__full-article__header-nav__link" to={'/blog'}> | ||
<BsArrowLeft className="ct__full-article__header-nav__link-arrow" size={30} style={{ color: `${arrowColor}`, zIndex: 1 }} /> | ||
</Link> | ||
<div className="ct__full-article__header-nav"> | ||
<AnimatePresence> | ||
{!showDetails && ( | ||
<motion.div className="ct__full-article__header-nav__author" layoutId="author" onClick={() => setShowDetails(true)}> | ||
{author.image && author.image.asset && ( | ||
<> | ||
<motion.img src={urlFor(author.image.asset).url()} alt={author.name} /> | ||
<motion.p>by {author.name}</motion.p> | ||
</> | ||
)} | ||
</motion.div> | ||
)} | ||
|
||
{showDetails && ( | ||
<motion.div | ||
className="ct__full-article__header-nav__author open" | ||
layoutId="author-details" | ||
positionTransition | ||
initial={{ opacity: 0, scale: 0.5 }} | ||
animate={{ opacity: 1, scale: 1 }} | ||
exit={{ opacity: 0, scale: 0.5 }} | ||
> | ||
<motion.img src={urlFor(author.image.asset).url()} alt={author.name} /> | ||
<motion.div className="expanded-article-details-data"> | ||
<motion.h3>{author.name}</motion.h3> | ||
{author.bio && <BlockContent blocks={author.bio} />} | ||
</motion.div> | ||
<motion.button onClick={() => setShowDetails(false)}> | ||
<IoMdClose /> | ||
</motion.button> | ||
</motion.div> | ||
)} | ||
</AnimatePresence> | ||
</div> | ||
<div className="ct__full-article__header-h1"> | ||
<h1 style={{ color: `${titleColor}`, filter: `${titleFilter}` }}>{title}</h1> | ||
<div className="ct__full-article__header-data" style={{ color: `${headerDataColor}` }}> | ||
<p>{publishedAt}</p> | ||
<span>•</span> | ||
{categories && <p>{categories.map((category) => category.title).join(', ')}</p>} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FullArticleHeader; |
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,28 @@ | ||
import React from 'react'; | ||
import { Helmet } from 'react-helmet'; | ||
|
||
const HelmetFullArticle = ({ title, desc, keywords, slug, headerImageLink }) => { | ||
return ( | ||
<Helmet> | ||
<title>{title}</title> | ||
<meta name="description" content={desc} /> | ||
<meta name="keywords" content={keywords} /> | ||
<meta property="og:locale" content="en_US" /> | ||
<meta property="og:type" content="article" /> | ||
<meta property="og:title" content={title} /> | ||
<meta property="og:description" content={desc} /> | ||
<meta property="og:url" content={'https://curiositytakeover.com/blog/' + slug} /> | ||
<meta property="og:site_name" content="Curiosity Takeover" /> | ||
<meta property="og:image" content={headerImageLink} /> | ||
<meta property="og:image:width" content="1200" /> | ||
<meta property="og:image:height" content="800" /> | ||
<meta property="og:image:type" content="image/png" /> | ||
<meta name="twitter:card" content="summary_large_image" /> | ||
<meta name="twitter:creator" content="@curiosity__blog" /> | ||
<meta name="twitter:site" content="@curiosity__blog" /> | ||
<meta name="twitter:image" content={headerImageLink} /> | ||
</Helmet> | ||
); | ||
}; | ||
|
||
export default HelmetFullArticle; |
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,2 @@ | ||
export { default as FullArticleHeader } from './FullArticleHeader'; | ||
export { default as HelmetFullArticle } from './HelmetFullArticle'; |