forked from elliotBraem/efizzybot
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from PotLock/landing-page-new
Landing page new
- Loading branch information
Showing
38 changed files
with
2,186 additions
and
373 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React from "react"; | ||
import tweetData from "../data/tweets.json"; | ||
import { Tweet } from "react-tweet"; | ||
import { ErrorBoundary } from "next/dist/client/components/error-boundary"; | ||
|
||
const TweetWall = () => { | ||
const [currentIndex, setCurrentIndex] = React.useState(0); | ||
|
||
const handleScroll = (event) => { | ||
const scrollLeft = event.target.scrollLeft; | ||
const width = event.target.clientWidth; | ||
const newIndex = Math.round(scrollLeft / width); | ||
setCurrentIndex(newIndex); | ||
}; | ||
|
||
return ( | ||
<div data-theme="light"> | ||
<div className="hidden md:grid md:grid-cols-3"> | ||
{tweetData.tweetIds.map((tweetId, index) => ( | ||
<div | ||
key={index} | ||
className={`p-8 ${index < 6 ? "border-b" : ""} ${ | ||
index % 3 !== 2 ? "border-r" : "" | ||
} border-[#57606A] `} | ||
style={{ | ||
height: "500px", | ||
overflowY: "scroll", | ||
scrollbarWidth: "none", | ||
}} | ||
> | ||
<ErrorBoundary | ||
fallback={ | ||
<div className="p-4 text-gray-500">Failed to load tweet</div> | ||
} | ||
> | ||
<Tweet id={tweetId} /> | ||
</ErrorBoundary> | ||
</div> | ||
))} | ||
</div> | ||
<div className="md:hidden"> | ||
<div | ||
className="flex overflow-x-auto snap-x snap-mandatory scrollbar-hide" | ||
onScroll={handleScroll} | ||
> | ||
{tweetData.tweetIds.map((tweetId, index) => ( | ||
<div | ||
key={index} | ||
className="mb-4 min-w-full flex-shrink-0 snap-center mx-auto p-4 md:p-8 border-b border-[#57606A] flex justify-center" | ||
> | ||
<ErrorBoundary | ||
fallback={ | ||
<div className="p-4 text-gray-500">Failed to load tweet</div> | ||
} | ||
> | ||
<Tweet id={tweetId} className="mx-auto" /> | ||
</ErrorBoundary> | ||
</div> | ||
))} | ||
</div> | ||
<div className="flex justify-center gap-2 mt-4 mb-6"> | ||
{tweetData.tweetIds.map((_, index) => ( | ||
<div | ||
key={index} | ||
className={`h-2 w-2 rounded-full ${ | ||
index === currentIndex ? "bg-black" : "bg-gray-200" | ||
}`} | ||
/> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TweetWall; |
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,8 @@ | ||
{ | ||
"tweetIds": [ | ||
"1881684365459280082", | ||
"1881680249311883591", | ||
"1886638266876879340", | ||
"1886318920996409814" | ||
] | ||
} |
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,6 @@ | ||
/** @type {import('next').NextConfitg } */ | ||
const nextConfig = { | ||
transpilePackages: ["react-tweet"], | ||
}; | ||
|
||
export default nextConfig; |
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.