Skip to content

Commit

Permalink
🩹 ish: fix jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
Bear29ers committed Jun 30, 2024
1 parent 3a4734d commit 4789d73
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/app/gallery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import type { NextPage } from 'next';

const Gallery: NextPage = () => {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);

useEffect(() => {
fetch('/api/instagram')
Expand All @@ -29,17 +27,12 @@ const Gallery: NextPage = () => {
})
.then((data) => {
setData(data);
setLoading(false);
})
.catch((err) => {
setError('Error fetching data');
setLoading(false);
console.error(err);
});
}, []);

if (loading) return <div>Loading...</div>;
if (error) return <div>{error}</div>;
if (!data) return <div>No data</div>;

return (
Expand All @@ -48,17 +41,24 @@ const Gallery: NextPage = () => {
<AnimatedText text="Gallery" classes="text-[48px] xs:text-[60px] xsm:text-[80px]" />
</div>
<div>
{data.media.data.map((post, index) => (
<div key={index}>
<img src={post.media_url} alt={post.caption} />
<p>{post.caption}</p>
<p>Likes: {post.like_count}</p>
<p>Posted by: {post.username}</p>
<a href={post.permalink} target="_blank" rel="noopener noreferrer">
View on Instagram
</a>
<h1>Instagram Gallery</h1>
{!data || !data.media.data.length ? (
<div>No data available</div>
) : (
<div className="gallery">
{data.media.data.map((post, index) => (
<div key={index} className="post">
<img src={post.media_url} alt={post.caption} />
<p>{post.caption}</p>
<p>Likes: {post.like_count}</p>
<p>Posted by: {post.username}</p>
<a href={post.permalink} target="_blank" rel="noopener noreferrer">
View on Instagram
</a>
</div>
))}
</div>
))}
)}
</div>
{/* Footer */}
<Footer />
Expand Down

0 comments on commit 4789d73

Please sign in to comment.