Skip to content

Commit 6fb9606

Browse files
Twitter Tweet Embed Added
1 parent d5b6814 commit 6fb9606

File tree

6 files changed

+51
-2
lines changed

6 files changed

+51
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Yes, you can fork this repo. Please give me proper credit by linking back to [br
4747
nvm install
4848
```
4949

50-
3. Install dependencies
50+
3. Install dependencies. Use `yarn`, don't use `npm`
5151

5252
```sh
5353
yarn

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"react-dom": "^17.0.2",
5858
"react-helmet": "^6.1.0",
5959
"react-transition-group": "^4.3.0",
60+
"react-twitter-embed": "^4.0.4",
6061
"scrollreveal": "^4.0.5",
6162
"styled-components": "^5.3.0"
6263
},

src/components/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export { default as Jobs } from './sections/jobs';
1313
export { default as Featured } from './sections/featured';
1414
export { default as Projects } from './sections/projects';
1515
export { default as Contact } from './sections/contact';
16+
export { default as TwitterTweets } from './sections/tweet';

src/components/sections/tweet.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
3+
To embed tweets, the react-twitter-embed package is used. In the below code, simply add the TwitterTweetEmbed element and tweets will be displayed.
4+
5+
The tweets are shown left-to-right top-to-bottom in 3 columns on desktop and 1 column on mobile.
6+
7+
*/
8+
9+
import React from 'react';
10+
import { TwitterTweetEmbed } from 'react-twitter-embed';
11+
12+
export default function TwitterTweets() {
13+
return (
14+
<div>
15+
<ul
16+
style={{
17+
display: 'flex',
18+
flexDirection: 'row',
19+
flexWrap: 'wrap',
20+
listStyleType: 'none',
21+
justifyContent: 'center',
22+
columnGap: '10px',
23+
}}>
24+
<TwitterTweetEmbed tweetId={'1539670459142537216'} />
25+
26+
<TwitterTweetEmbed tweetId={'1540022171149701120'} />
27+
28+
<TwitterTweetEmbed tweetId={'1536600005884391424'} />
29+
30+
<TwitterTweetEmbed tweetId={'1538976281844662272'} />
31+
</ul>
32+
</div>
33+
);
34+
}

src/pages/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import styled from 'styled-components';
4-
import { Layout, Hero, About, Jobs, Featured, Projects, Contact } from '@components';
4+
import { Layout, Hero, About, Jobs, Featured, Projects, Contact, TwitterTweets } from '@components';
55

66
const StyledMainContainer = styled.main`
77
counter-reset: section;
@@ -15,6 +15,7 @@ const IndexPage = ({ location }) => (
1515
<Jobs />
1616
<Featured />
1717
<Projects />
18+
<TwitterTweets />
1819
<Contact />
1920
</StyledMainContainer>
2021
</Layout>

yarn.lock

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11333,6 +11333,13 @@ react-transition-group@^4.3.0:
1133311333
loose-envify "^1.4.0"
1133411334
prop-types "^15.6.2"
1133511335

11336+
react-twitter-embed@^4.0.4:
11337+
version "4.0.4"
11338+
resolved "https://registry.yarnpkg.com/react-twitter-embed/-/react-twitter-embed-4.0.4.tgz#4a6b8354acc266876ff1110b9f648518ea20db6d"
11339+
integrity sha512-2JIL7qF+U62zRzpsh6SZDXNI3hRNVYf5vOZ1WRcMvwKouw+xC00PuFaD0aEp2wlyGaZ+f4x2VvX+uDadFQ3HVA==
11340+
dependencies:
11341+
scriptjs "^2.5.9"
11342+
1133611343
react@^17.0.2:
1133711344
version "17.0.2"
1133811345
resolved "https://registry.npmjs.org/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037"
@@ -11975,6 +11982,11 @@ schema-utils@^3.0, schema-utils@^3.0.0:
1197511982
ajv "^6.12.5"
1197611983
ajv-keywords "^3.5.2"
1197711984

11985+
scriptjs@^2.5.9:
11986+
version "2.5.9"
11987+
resolved "https://registry.yarnpkg.com/scriptjs/-/scriptjs-2.5.9.tgz#343915cd2ec2ed9bfdde2b9875cd28f59394b35f"
11988+
integrity sha512-qGVDoreyYiP1pkQnbnFAUIS5AjenNwwQBdl7zeos9etl+hYKWahjRTfzAZZYBv5xNHx7vNKCmaLDQZ6Fr2AEXg==
11989+
1197811990
scrollreveal@^4.0.5:
1197911991
version "4.0.9"
1198011992
resolved "https://registry.npmjs.org/scrollreveal/-/scrollreveal-4.0.9.tgz#47866e1967ff604e64bac28818fe0dcea44f2c8b"

0 commit comments

Comments
 (0)