Skip to content
This repository has been archived by the owner on Nov 28, 2020. It is now read-only.

Add Content - "Things I don't know" post #44

Merged
merged 8 commits into from
Feb 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
255 changes: 255 additions & 0 deletions blog/2019/04/things-i-dont-know-2018/index.md

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const myQuery = `{
description
image {
childImageSharp {
fluid {
fluid(quality: 100, maxWidth: 1500, fit: CONTAIN) {
base64
tracedSVG
srcWebp
Expand Down Expand Up @@ -109,7 +109,11 @@ module.exports = {
{
resolve: `gatsby-remark-images`,
options: {
maxWidth: 590,
maxWidth: 780,
// https://github.com/gatsbyjs/gatsby/issues/20000
// markdownCaptions: true,
showCaptions: true,
quality: 100,
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ exports.createPages = async ({ graphql, actions }) => {
categories
image {
childImageSharp {
fluid {
fluid(quality: 100, maxWidth: 1500, fit: CONTAIN) {
base64
tracedSVG
srcWebp
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@typescript-eslint/parser": "^2.20.0",
"awesome-typescript-loader": "^5.2.1",
"babel-loader": "^8.0.6",
"babel-plugin-remove-graphql-queries": "^2.7.23",
"babel-plugin-styled-components": "^1.10.7",
"babel-preset-gatsby": "^0.2.29",
"babel-preset-react-app": "^9.1.1",
Expand Down
26 changes: 26 additions & 0 deletions src/html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,35 @@ const GatsbyHTML: React.FC<PreRenderHTMLArgs & { body: string }> = (props) => {
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>

{props.headComponents}
</head>
<body {...props.bodyAttributes} className="dark">
<script
data-testid="twitter-script"
dangerouslySetInnerHTML={{
__html: `
(function(){
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);

t._e = [];
t.ready = function(f) {
t._e.push(f);
};

return t;
}(document, "script", "twitter-wjs"));
})()
`,
}}
/>
{/* HERE'S THE SCRIPT TO HANDLE THEME :D */}
<script
dangerouslySetInnerHTML={{
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const query = graphql`
description
image {
childImageSharp {
fluid {
fluid(quality: 100, maxWidth: 1500, fit: CONTAIN) {
base64
tracedSVG
srcWebp
Expand Down
43 changes: 43 additions & 0 deletions src/styles/blogPost.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { css, createGlobalStyle } from 'styled-components';
import media from 'styled-media-query';
import { transparentize } from 'polished';

const global = css`
body {
Expand All @@ -12,6 +14,7 @@ const global = css`
font-family: ${({ theme }) => theme.font.contentTitle};
line-height: 4.8rem;
}

p {
letter-spacing: -0.084px;
margin-bottom: -8.28px;
Expand All @@ -34,6 +37,7 @@ const global = css`
background-repeat: repeat-x;
}
}

blockquote {
margin-left: -2rem;
padding-left: 2.3rem;
Expand Down Expand Up @@ -64,16 +68,55 @@ const global = css`
h5,
h6 {
font-family: ${({ theme }) => theme.font.contentSans};
line-height: 1;
}

h2 {
font-size: 3.4rem;
font-weight: 600;
}

h1 + p,
h2 + p,
h3 + p,
h4 + p,
h5 + p,
h6 + p {
margin-top: 1.2rem;
${media.greaterThan('small')`
margin-top: 1.8rem;
`}
}

p + h1,
p + h2,
p + h3,
p + h4,
p + h5,
p + h6 {
margin-top: 2.2rem;
${media.greaterThan('small')`
margin-top: 3rem;
`}
}

a {
text-decoration: ${({ theme }) => theme.color.font};
}

.twitter-tweet {
margin: 4rem auto !important;
}

.gatsby-resp-image-figcaption {
font-family: ${({ theme }) => theme.font.contentSans};
text-align: center;
margin: 0;
margin-top: 1rem;
line-height: 1.4;
font-size: 1.6rem;
color: ${transparentize(0.4, '#000')};
}
`;

export const BlogGlobalStyle = createGlobalStyle`
Expand Down
8 changes: 8 additions & 0 deletions src/templates/blog-post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const StyledImg = styled(Img)`

const ImgWrapper = styled(Container)`
max-width: 1192px;
padding-bottom: 7rem;
`;

type PostProps = {
Expand All @@ -36,6 +37,13 @@ type PostProps = {
};

const Post: React.FC<PostProps> = ({ pageContext }) => {
React.useEffect(() => {
/* This loads all widgets from twitter if exists.
It's loaded by html.tsx (data-testid="twitter-script")
*/
// @ts-ignore
window.twttr.widgets.load();
}, []);
const { postByLocale, intl } = pageContext;

const post = postByLocale[intl.language];
Expand Down