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
19 changed files
with
1,560 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,107 @@ | ||
export default ({ desc, href, children, wide }) => ( | ||
<div className={ wide && 'wide' }> | ||
{ href | ||
? <a href={ href } target="_blank">{ children }</a> | ||
: children } | ||
{ | ||
desc && <p> | ||
{ desc } | ||
</p> | ||
} | ||
const Figure = ({ desc, href, children, wide, height, width }) => { | ||
const content = | ||
height && width ? ( | ||
<div | ||
style={{ | ||
position: "relative", | ||
display: "inline-block", | ||
maxWidth: "100%", | ||
overflow: "hidden" | ||
}} | ||
> | ||
<div | ||
style={{ | ||
width, | ||
paddingBottom: (height / width) * 100 + "%" | ||
}} | ||
/> | ||
<div | ||
style={{ | ||
position: "absolute", | ||
left: 0, | ||
right: 0, | ||
top: 0, | ||
margin: "auto", | ||
height: "auto", | ||
maxWidth: "100%" | ||
}} | ||
> | ||
{children} | ||
</div> | ||
</div> | ||
) : ( | ||
children | ||
); | ||
return ( | ||
<div className={wide && "wide"}> | ||
{href ? ( | ||
<a href={href} target="_blank"> | ||
{content} | ||
</a> | ||
) : ( | ||
content | ||
)} | ||
{desc && <p>{desc}</p>} | ||
<style jsx>{` | ||
div { | ||
text-align: center; | ||
} | ||
p { | ||
font-size: 13px; | ||
color: #999; | ||
text-align: center; | ||
display: block; | ||
margin-top: 10px; | ||
} | ||
.wide { | ||
background: #f2f2f2; | ||
position: relative; | ||
} | ||
.wide::before { | ||
width: 10000%; | ||
content: ""; | ||
left: -1000px; | ||
height: 100%; | ||
position: absolute; | ||
background: #f2f2f2; | ||
z-index: -1; | ||
} | ||
`}</style> | ||
</div> | ||
); | ||
}; | ||
|
||
const Image = ({ style, width, src }) => ( | ||
<div style={style}> | ||
<img | ||
async | ||
loading="lazy" | ||
decoding="async" | ||
importance="low" | ||
width={width} | ||
src={src} | ||
/> | ||
<style jsx>{` | ||
div { | ||
text-align: center; | ||
margin-bottom: 20px; | ||
} | ||
p { | ||
font-size: 13px; | ||
color: #999; | ||
text-align: center; | ||
font-style: oblique; | ||
display: block; | ||
} | ||
.wide { | ||
background: #F2F2F2; | ||
position: relative; | ||
} | ||
.wide::before { | ||
width: 10000%; | ||
content: ''; | ||
left: -1000px; | ||
height: 100%; | ||
position: absolute; | ||
background: #F2F2F2; | ||
z-index: -1; | ||
margin: auto; | ||
} | ||
`}</style> | ||
</div> | ||
) | ||
|
||
const Image = ({ width, src }) => ( | ||
<div> | ||
<img width={width} src={src} /> | ||
<style jsx>{` | ||
img { | ||
max-width: 100%; | ||
margin: 15px 0; | ||
} | ||
`}</style> | ||
</div> | ||
) | ||
); | ||
|
||
const Video = ({ src }) => ( | ||
<div> | ||
<video autoPlay loop src={src} /> | ||
<style jsx>{` | ||
video { | ||
max-width: 100%; | ||
margin: 15px 0; | ||
} | ||
`}</style> | ||
</div> | ||
) | ||
); | ||
|
||
export { Image, Video } | ||
export default Figure; | ||
export { Image, Video }; |
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 |
---|---|---|
@@ -1,17 +1,39 @@ | ||
export default ({ children }) => ( | ||
<pre> | ||
<code>{children}</code> | ||
export default ({ children, caption = null }) => ( | ||
<div> | ||
<pre> | ||
<code>{children}</code> | ||
</pre> | ||
|
||
{caption != null ? <p>{caption}</p> : null} | ||
|
||
<style jsx>{` | ||
pre { | ||
line-height: 24px; | ||
margin-bottom: 20px; | ||
background: #000; | ||
padding: 20px; | ||
margin: 0 0 10px; | ||
overflow-x: auto; | ||
} | ||
div { | ||
margin-bottom: 20px; | ||
} | ||
p { | ||
font-size: 14px; | ||
color: #999; | ||
text-align: center; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
p :global(code) { | ||
color: #333; | ||
} | ||
code { | ||
color: #fff; | ||
} | ||
`}</style> | ||
</pre> | ||
</div> | ||
); |
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,40 @@ | ||
import { TwitterTweetEmbed } from "react-twitter-embed"; | ||
|
||
export default function Tweet({ id, caption }) { | ||
return ( | ||
<main> | ||
<div> | ||
<TwitterTweetEmbed tweetId={id} /> | ||
</div> | ||
{caption != null ? <p>{caption}</p> : null} | ||
|
||
<style jsx>{` | ||
main { | ||
margin: 30px 0; | ||
} | ||
p { | ||
font-size: 14px; | ||
color: #999; | ||
text-align: center; | ||
margin: 0; | ||
margin-top: 10px; | ||
padding: 0; | ||
} | ||
main :global(.twitter-tweet) { | ||
margin: auto !important; | ||
} | ||
@media (max-width: 600px) { | ||
main :global(.twitter-tweet) { | ||
max-width: 300px !important; | ||
width: 300px !important; | ||
position: relative; | ||
left: 0 !important; | ||
} | ||
} | ||
`}</style> | ||
</main> | ||
); | ||
} |
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
Oops, something went wrong.
b01d4f4
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 following URLs: