-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
12 changed files
with
83 additions
and
139 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,34 @@ | ||
import { TwitterTimelineEmbed, TwitterTweetEmbed } from 'react-twitter-embed'; | ||
import { twitter } from '../Embed.module.scss'; | ||
import { useEffect } from 'react'; | ||
|
||
const Twitter = (props) => { | ||
const { url } = props; | ||
|
||
// Single Tweet | ||
if (url.includes('/status/')) { | ||
const tweetID = url.split('/status/')[1]; | ||
if (!url) return null; | ||
|
||
const hasStatus = url.includes('status'); | ||
const twitterTag = hasStatus ? 'twitter-tweet' : 'twitter-timeline'; | ||
|
||
useEffect(() => { | ||
const script = document.createElement('script'); | ||
script.src = 'https://platform.twitter.com/widgets.js'; | ||
document.getElementsByClassName(twitterTag)[0].appendChild(script); | ||
}, []); | ||
|
||
if (hasStatus) { | ||
return ( | ||
<div className={twitter}> | ||
<blockquote className={twitterTag}> | ||
<a href={`${url}`}></a> | ||
</blockquote> | ||
</div> | ||
); | ||
} else { | ||
return ( | ||
<div className={twitter}> | ||
<TwitterTweetEmbed tweetId={tweetID} /> | ||
<a className={twitterTag} href={url}></a> | ||
</div> | ||
); | ||
} | ||
|
||
// User Timeline | ||
const userName = url.split('twitter.com/')[1]; | ||
return ( | ||
<div className={twitter}> | ||
<TwitterTimelineEmbed | ||
sourceType='profile' | ||
screenName={userName} | ||
options={{ height: 600 }} | ||
/> | ||
</div> | ||
); | ||
}; | ||
export default Twitter; |
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 |
---|---|---|
@@ -1,37 +1,27 @@ | ||
import Image from 'next/image'; | ||
import styles from './Image.module.scss'; | ||
import useApi from 'hooks/useApi'; | ||
|
||
const ImageCore = (props) => { | ||
const { id, align } = props.attrs; | ||
const { data: image, isLoading, isError } = useApi(`/api/media/${id}`); | ||
|
||
if (isLoading) return 'loading ...'; | ||
if (isError) return 'Error!'; | ||
|
||
const { width, height } = image.media_details; | ||
const imageSrc = image.source_url; | ||
const imageAlt = image.alt_text; | ||
|
||
const imageAlign = { | ||
left: 'float-left mr-3', | ||
right: 'float-right ml-3', | ||
}; | ||
|
||
const { media, imageSize = 'full' } = props.attrs || props.attributes; | ||
const { url, width, height } = media?.sizes[imageSize]; | ||
const { alt, caption } = media; | ||
return ( | ||
<div className={`text-${align} ${align === 'full' && styles.full}`}> | ||
<figure | ||
className={`${styles.figure} ${imageAlign[align]} mt-4 mb-5`} | ||
data-aos='fade-in' | ||
> | ||
<Image | ||
src={imageSrc} | ||
alt={imageAlt} | ||
width={width || 1440} | ||
height={height || 900} | ||
<figure className={`${styles.figure} mt-4 mb-5`} data-aos='fade-in'> | ||
<Image | ||
src={url} | ||
alt={alt} | ||
width={width || 800} | ||
height={height || 600} | ||
className={styles.image} | ||
/> | ||
{caption && ( | ||
<figcaption | ||
className={styles.figureCaption} | ||
style={{ width: `${width}px` }} | ||
dangerouslySetInnerHTML={{ __html: caption }} | ||
/> | ||
</figure> | ||
</div> | ||
)} | ||
</figure> | ||
); | ||
}; | ||
export default ImageCore; |
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 |
---|---|---|
@@ -1,46 +1,24 @@ | ||
.figure { | ||
position: relative; | ||
display: inline-flex; | ||
display: flex; | ||
justify-content: center; | ||
|
||
div { | ||
border-radius: var(--border-radius); | ||
box-shadow: var(--shadow); | ||
} | ||
|
||
.figure-caption { | ||
position: absolute; | ||
bottom: 0; | ||
width: 100%; | ||
padding: 20% 1rem 1rem 1rem; | ||
color: var(--white); | ||
text-align: left; | ||
border-bottom-left-radius: var(--border-radius); | ||
border-bottom-right-radius: var(--border-radius); | ||
background: rgb(0, 0, 0); | ||
background: linear-gradient( | ||
0deg, | ||
rgba(0, 0, 0, 1) 0%, | ||
rgba(0, 0, 0, 0) 100% | ||
); | ||
background-color: var(--grey-light); | ||
} | ||
} | ||
|
||
.full { | ||
position: relative; | ||
|
||
.figure { | ||
position: relative; | ||
width: 100vw; | ||
position: relative; | ||
margin-left: -50vw; | ||
left: 50%; | ||
|
||
div, | ||
img, | ||
figcaption { | ||
border-radius: 0; | ||
width: 100%; | ||
max-height: 90vh; | ||
} | ||
} | ||
.figureCaption { | ||
position: absolute; | ||
bottom: 0; | ||
width: 100%; | ||
padding: 20% 1rem 1rem 1rem; | ||
color: var(--white); | ||
text-align: left; | ||
border-bottom-left-radius: var(--border-radius); | ||
border-bottom-right-radius: var(--border-radius); | ||
background: rgb(0, 0, 0); | ||
background: linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%); | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
360b5d6
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: