Skip to content

Commit

Permalink
Merge pull request #377 from Anirban-1490/mentiontweet
Browse files Browse the repository at this point in the history
Added A Home page section for Twitter mentions
  • Loading branch information
atapas committed Jul 22, 2022
2 parents c365a4c + 02cf06b commit f34f20c
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.0",
"react-shimmer-effect": "^1.0.9",
"react-twitter-widgets": "^1.11.0",
"redux": "^4.2.0",
"redux-persist": "^6.0.0",
"reselect": "^4.1.5",
Expand Down
53 changes: 53 additions & 0 deletions src/common/home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import FeaturedPlays from "common/playlists/FeaturedPlays";
import Contributors from "./Contributors";
import ExtendedFooter from "common/footer/ExtendedFooter";
import { SearchContext } from "common/search/search-context";
import { Tweet } from "react-twitter-widgets";
import Spinner from "../spinner/spinner"




const Home = () => {
const [gitHubStars, setGitHubStars] = useState("...");
Expand All @@ -31,6 +36,32 @@ const Home = () => {
});
}, [data, setSearchTerm, searchTerm, setFilterQuery]);

//* array of tweet IDs to show on the home page
const tweetIdArray = [
"1544376341172068352",
"1530197614771458049",
"1529884210269671424",
"1522165831005728769",
"1521784126717710336",
"1518200201302974464",
"1541802575775035392",
"1515598358748237830",
"1528938773710782464",
"1532349503709122561"
]

//* set the state for loading

const [isTweetsLoading,setTweetsLoading] = useState(true)



function tweetLoadHandler (){
//* as soon as tweets loads on DOM disable the loading spinner
setTweetsLoading(false)
}


return (
<div>
<section className="app-home-body">
Expand Down Expand Up @@ -133,6 +164,28 @@ const Home = () => {
</Link>
</div>
</section>
<section className="home-tweets">
<h3 className="title-primary">
What Our <strong>
<span>Community</span>
</strong> Says!
</h3>

{
(isTweetsLoading) ? <Spinner/> :""
}
<div className="tweets-container active" >
{

tweetIdArray.map(id=> {

return <Tweet key={id} tweetId={id}
onLoad={tweetLoadHandler} options={{width:'410' ,conversation:"none",cards:"hidden",align:"center"}} />
})
}
</div>

</section>
<section className="home-contributors">
<Contributors />
</section>
Expand Down
55 changes: 51 additions & 4 deletions src/common/home/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,53 @@
text-align: center;
}

/* Tweet section */

.home-tweets{
position: relative;
padding: 5rem 0 6rem 0;

background-color: var(--color-neutral-20);

}
.home-tweets .title-primary{
text-align: center;
margin-top: 1.5rem !important;


}


.tweets-container.active{

width: 90.5%;
margin: 0 auto;
margin-top: 4.5em;
display: flex;
/* grid-template-columns: repeat(auto-fit,370px);
grid-template-rows: repeat(auto-fill,400px);
grid-auto-rows:auto;
grid-auto-columns: auto;
grid-row-gap:1em; */
justify-content: center;
align-items:center;
/* row-gap: 1.3em; */
flex-wrap: wrap;
gap: 1em;
margin-bottom: 2em;
}

.tweets-container > div{

/* height: fit-content; */
width: clamp(5em,320px,44em);
/* max-width: 410px; */
filter: drop-shadow(0 0 10px rgba(0, 0, 0, 0.097));


}



/* Home Contributors */
.home-contributors {
Expand All @@ -381,7 +428,7 @@
background-color: var(--color-neutral-10);
}

.home-contributors .title-primary {
.home-contributors .title-primary,.home-tweets .title-primary {
position: relative;
margin: 0 0 3rem 0;
font-family: var(--ff-accent);
Expand All @@ -391,17 +438,17 @@
line-height: 1.2;
}

.home-contributors .title-primary strong {
.home-contributors .title-primary strong , .home-tweets .title-primary strong {
position: relative;
font-family: var(--ff-accent);
position: relative;
}
.home-contributors .title-primary strong span {
.home-contributors .title-primary strong span, .home-tweets .title-primary strong span {
position: relative;
font-family: var(--ff-accent);
}

.home-contributors .title-primary strong:before {
.home-contributors .title-primary strong:before, .home-tweets .title-primary strong:before {
content:"";
position: absolute;
height: 4px;
Expand Down

1 comment on commit f34f20c

@vercel
Copy link

@vercel vercel bot commented on f34f20c Jul 22, 2022

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:

react-play – ./

reactoplay.vercel.app
react-play-git-main-atapas.vercel.app
react-play-atapas.vercel.app

Please sign in to comment.