Skip to content

Commit

Permalink
gfd
Browse files Browse the repository at this point in the history
  • Loading branch information
neerajrekwar committed Jul 23, 2024
1 parent 977b72f commit 56aac7a
Show file tree
Hide file tree
Showing 6 changed files with 971 additions and 105 deletions.
119 changes: 119 additions & 0 deletions app/components/InstagramEmbed.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
"use client"

import Image from "next/image";
import Link from "next/link";
import { useEffect, useState } from "react";

type InstagramPost = {
id: string;
caption: string;
media_url: string;
media_type: string;
timestamp: string;
permalink: string;
}

type InstagramPaging = {
cursors: {
before: string;
after: string;
}
}

type InstagramFeed = {
data: InstagramPost[];
paging?: InstagramPaging;
}

export default function InstagramEmbed() {
const [instagramFeed, setInstagramFeed] = useState<InstagramFeed | null>(null);
const [after, setAfter] = useState<string | null>(null);
const [error, setError] = useState<string | null>(null);

const fetchFeed = async (after: string | null = null) => {
try {
let url = `https://graph.instagram.com/me/media?fields=id,caption,media_url,media_type,timestamp,permalink&access_token=${process.env.NEXT_PUBLIC_INSTAGRAM_TOKEN}`;
if (after) {
url += `&after=${after}`;
}
const data = await fetch(url);

if (!data.ok) {
throw new Error("Failed to fetch Instagram feed");
}

const feed = await data.json();
console.log(feed)

setInstagramFeed(prevFeed => {
if (prevFeed && prevFeed.data.length > 0) {
return {
...feed,
data: [...prevFeed.data, ...feed.data]
};
}
return feed;
});
setAfter(feed.paging?.cursors.after);
} catch (err: any) {
console.error("Error fetching Instagram feed:", err.message);
setError(err.message);
}
};

const loadMore = () => {
fetchFeed(after);
};

// Fetch the initial feed
useEffect(() => {
fetchFeed();
}, []);

return (
<>
{error && <p className="text-red-500">{error}</p>}

{instagramFeed && (
<section className="w-full flex flex-col justify-center items-center">
<h2 className="text-2xl font-semibold">Instagram Feed:</h2>
<div className="w-full grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
{instagramFeed.data.map((post: InstagramPost) => (
<div key={post.id} className="relative group w-full h-[300px]">
<Link
href={post.permalink}
target="_blank"
rel="noopener noreferrer"
className="relative"
>
{post.media_type === "VIDEO" ? (
<video
src={post.media_url}
controls={false}
className="w-full h-full object-cover"
/>
) : (
<Image
src={post.media_url}
alt={post.caption ?? ""}
className="w-full h-full object-cover"
width={300}
height={300}
/>
)}

<div className="absolute inset-0 opacity-0 group-hover:opacity-100 transition duration-300 bg-black bg-opacity-50 flex items-center justify-center p-4 w-full h-[300px]">
<p className="text-white text-center text-xs truncate">
{post.caption}
</p>
</div>
</Link>
</div>
))}
</div>
{after && <button onClick={loadMore}>Load More</button>}
</section>
)}
</>
);
}
22 changes: 11 additions & 11 deletions app/components/VisionSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const VisionSection: React.FC = () => {
<div className="text-4xl text-third sm:text-5xl sm:mx-2">&#8226;</div>
Vision to the Future
</div>
<div className="text-five min-h-screen md:bg-gradient-to-r from-seven md:rounded-ss-2xl">
<div className="text-four min-h-screen md:bg-gradient-to-r from-seven md:rounded-ss-2xl">
<div className="md:h-80 mb-20 md:flex-row md:flex gap-4 border-four">
<div
style={{
Expand All @@ -22,18 +22,18 @@ export const VisionSection: React.FC = () => {
className="text-five basis-1/2 font-bold rounded-2xl m-2 p-4 h-60 md:h-auto"
></div>
<div className="basis-1/2 text-base md:text-xl p-4">
<h2 className="text-4xl md:text-6xl font-bold pb-2 text-five ">
<h2 className="text-4xl md:text-6xl font-bold pb-2 text-five">
UI/UX Design
</h2>
<p>
Websites will{" "}
<a href="/" target="_blank" className="">
<strong className="text-four">
<strong className="text-five font-normal">
customization in website & changes
</strong>
</a>{" "}
analyze user behavior and preferences,
<strong className="text-four ">
<strong className="text-five font-normal">
{" "}
dynamically tailoring layouts, content, and recommendations to
each visitor.
Expand All @@ -44,7 +44,7 @@ export const VisionSection: React.FC = () => {
</div>
</div>
</div>
<div className="text-five min-h-screen md:bg-gradient-to-l pt-2 from-seven md:rounded-se-2xl">
<div className="text-four min-h-screen md:bg-gradient-to-l pt-2 from-seven md:rounded-se-2xl">
<div
style={{}}
className=" md:h-80 mb-20 md:flex-row-reverse md:flex gap-4 border-four"
Expand All @@ -64,21 +64,21 @@ export const VisionSection: React.FC = () => {
</h2>
<p >
Websites have evolved to seamlessly adapt to various devices,
ensuring a uniform and exceptional ,<strong className="text-yellow-600"> user experience on desktops,
ensuring a uniform and exceptional ,<strong className="text-five font-normal"> user experience on desktops,
mobiles, and tablets.</strong>
</p>
</div>
</div>
</div>
<div className="text-five min-h-screen md:bg-gradient-to-r from-seven md:rounded-ss-2xl">
<div className="text-four min-h-screen md:bg-gradient-to-r from-seven md:rounded-ss-2xl">
<div className="md:h-80 mb-20 md:flex-row md:flex gap-4 border-four">
<div
style={{
backgroundImage: `url('https://images.unsplash.com/photo-1536859355448-76f92ebdc33d?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1yZWxhdGVkfDIwfHx8ZW58MHx8fHx8')`,
backgroundSize: "cover",
backgroundPosition: "center",
}}
className="text-five basis-1/2 font-bold rounded-2xl m-2 p-4 h-60 md:h-auto"
className="text-four basis-1/2 font-bold rounded-2xl m-2 p-4 h-60 md:h-auto"
></div>
<div className="basis-1/2 text-base md:text-xl p-4">
<h2 className="text-4xl md:text-6xl font-bold pb-2 text-five ">
Expand All @@ -89,12 +89,12 @@ export const VisionSection: React.FC = () => {
flaws in a computer program that cause it to produce incorrect
outputs or behave unexpectedly. These bugs can vary from minor
inconveniences to critical issues that crash the program
entirely. Rest assured, <strong className="text-red-600">we&apos;ll solve your web programming bugs.</strong>
entirely. Rest assured, <strong className="text-five font-normal">we&apos;ll solve your web programming bugs.</strong>
</p>
</div>
</div>
</div>
<div className="text-five min-h-screen md:h-auto sm:bg-gradient-to-l pt-2 from-seven md:rounded-se-2xl">
<div className="text-four min-h-screen md:h-auto sm:bg-gradient-to-l pt-2 from-seven md:rounded-se-2xl">
<div
style={{}}
className="md:h-80 md:flex-row-reverse md:flex gap-4 border-four"
Expand All @@ -113,7 +113,7 @@ export const VisionSection: React.FC = () => {
Small Business Helps
</h2>
<p >
<strong className="text-green-600">Are you struggling to establish your online presence?</strong> Small Business Helps can be your one-stop shop for all your web development needs. We understand the unique challenges faced by small businesses, and our team of experts will craft a website that perfectly reflects your brand and resonates with your target audience. From user-friendly design and e-commerce functionality to powerful SEO optimization, we&apos;ll equip you with the tools to attract customers, boost sales, and achieve your online goals. Let Small Business Helps translate your vision into a website that works for you.
<strong className="text-five font-normal">Are you struggling to establish your online presence?</strong> Small Business Helps can be your one-stop shop for all your web development needs. We understand the unique challenges faced by small businesses, and our team of experts will craft a website that perfectly reflects your brand and resonates with your target audience. From user-friendly design and e-commerce functionality to powerful SEO optimization, we&apos;ll equip you with the tools to attract customers, boost sales, and achieve your online goals. Let Small Business Helps translate your vision into a website that works for you.
</p>
</div>
</div>
Expand Down
Loading

0 comments on commit 56aac7a

Please sign in to comment.