Skip to content

Commit 4172313

Browse files
committed
scuffed slider loop
1 parent b77c984 commit 4172313

14 files changed

+808
-303
lines changed

bun.lockb

11.1 KB
Binary file not shown.

package-lock.json

+660-286
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+12-11
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@
1010
},
1111
"dependencies": {
1212
"framer-motion": "^11.11.9",
13-
"next": "14.2.14",
14-
"react": "^18",
15-
"react-dom": "^18",
13+
"lenis": "^1.1.14",
14+
"next": "15.0.0-rc.1",
15+
"react": "^18.3.1",
16+
"react-dom": "^18.3.1",
1617
"react-intersection-observer": "^9.13.1",
17-
"vite": "^5.4.8"
18+
"vite": "^5.4.10"
1819
},
1920
"devDependencies": {
20-
"@types/node": "^20",
21-
"@types/react": "^18",
22-
"@types/react-dom": "^18",
23-
"eslint": "^8",
21+
"@types/node": "^20.17.0",
22+
"@types/react": "^18.3.12",
23+
"@types/react-dom": "^18.3.1",
24+
"eslint": "^8.57.1",
2425
"eslint-config-next": "14.2.14",
25-
"postcss": "^8",
26-
"tailwindcss": "^3.4.1",
27-
"typescript": "^5"
26+
"postcss": "^8.4.47",
27+
"tailwindcss": "^3.4.14",
28+
"typescript": "^5.6.3"
2829
}
2930
}

src/Components/assets/5factory.png

1.55 MB
Loading

src/Components/assets/bigbank.png

2.16 MB
Loading

src/Components/assets/ccmainmenu.png

2.14 MB
Loading

src/Components/assets/gamble1.png

1.67 MB
Loading

src/Components/assets/gamble2.png

1.54 MB
Loading
1.59 MB
Loading

src/Components/project.tsx

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"use client"
2+
3+
import React from "react";
4+
import Image from "next/image";
5+
6+
import { StaticImageData } from "next/image";
7+
8+
interface ProjectProps {
9+
imageSrc: StaticImageData;
10+
title: string;
11+
content: string;
12+
}
13+
14+
export default function Project({ imageSrc, title, content, }: ProjectProps) {
15+
16+
return (
17+
<>
18+
<div className="relative flex flex-col justify-between h-full">
19+
<Image src={imageSrc} alt="" className="w-full aspect-square object-cover rounded-[3vw] bg-thirdy cursor-pointer" />
20+
<div className="flex justify-between items-center relative z-10 rounded-lg py-5">
21+
<div className="flex flex-col gap-3 w-full h-[200px]">
22+
<div className="text-secondary text-[6vw] md:text-[2vw]">{title}</div>
23+
<div className="flex gap-1">
24+
</div>
25+
<div className="w-full flex justify-between">
26+
<div className="text-thirdy text-[3vw] md:text-[1vw] w-4/5">{content}</div>
27+
</div>
28+
</div>
29+
</div>
30+
</div>
31+
</>
32+
);
33+
}

src/Components/slider.tsx

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import { useState } from "react";
2+
import Project from "./project";
3+
import FadeIn from "./fadein";
4+
5+
6+
import citycaseImg1 from "@assets/5factory.png"
7+
import citycaseImg2 from "@assets/bigbank.png"
8+
import citycaseImg3 from "@assets/ccmainmenu.png"
9+
import citycaseImg4 from "@assets/gamble1.png"
10+
import citycaseImg5 from "@assets/gamble2.png"
11+
import citycaseImg6 from "@assets/peopleandtowers.png"
12+
13+
export default function Slider() {
14+
const projects = [
15+
{imageSrc: citycaseImg1, title: "City Case img#1", content: 'hello hello testestest'},
16+
{imageSrc: citycaseImg2, title: "City Case img#2", content: 'hello hello testestest'},
17+
{imageSrc: citycaseImg3, title: "City Case img#3", content: 'hello hello testestest'},
18+
{imageSrc: citycaseImg4, title: "City Case img#4", content: 'hello hello testestest'},
19+
{imageSrc: citycaseImg5, title: "City Case img#5", content: 'hello hello testestest'},
20+
{imageSrc: citycaseImg6, title: "City Case img#6", content: 'hello hello testestest'}
21+
];
22+
const[index, setIndex] = useState(0);
23+
const totalImages = projects.length
24+
25+
const next = () => {
26+
if(index < totalImages - 1){
27+
setIndex((prevIndex) => prevIndex + 1)
28+
}
29+
if (index >= totalImages -1){
30+
setIndex((prevIndex) => 0)
31+
}
32+
}
33+
const prev = () => {
34+
if (index > 0) {
35+
setIndex((prevIndex) => prevIndex - 1);
36+
}
37+
};
38+
39+
return (
40+
<FadeIn delay={0}>
41+
<div className="w-full p-5 md:p-10">
42+
<div className="grid grid-cols-3 grid-rows-1 overflow-hidden gap-5 md:gap-10">
43+
{projects.slice(index, index + 3).map((project) => (
44+
<div key={project.title}>
45+
<Project
46+
imageSrc={project.imageSrc}
47+
title={project.title}
48+
content={project.content}
49+
/>
50+
</div>
51+
))}
52+
</div>
53+
<div className="w-full flex justify-between items-center">
54+
<button onClick={prev} className='bg-secondary aspect-square rounded-full p-5' disabled={index === 0}>Prev</button>
55+
<div className="flex gap-3">
56+
{Array.from({ length: Math.ceil(totalImages) }).map((_, i) => (
57+
<div key={i} className={`aspect-square w-5 h-5 rounded-full ${i === Math.floor(index) ? 'bg-secondary scale-125' : 'bg-primary scale-100'}`}></div>
58+
))}
59+
</div>
60+
<button onClick={next} className='bg-secondary aspect-square rounded-full p-5' disabled={index >= totalImages}>Next</button>
61+
</div>
62+
</div>
63+
</FadeIn>
64+
);
65+
};
66+

src/app/(pages)/page2/page.tsx

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"use client"
22

3-
import React from "react";
3+
import React, {useEffect} from "react";
44
import Link from 'next/link';
55
import FadeIn from "@/Components/fadein";
6+
import Lenis from "lenis";
67

78
import RenderWidget from "@/Components/renderwidget";
89
import renderbrain from "./Assets/brainrender.png"
@@ -14,6 +15,16 @@ import FugaRender from "./Assets/fuga.png"
1415

1516

1617
export default function Home() {
18+
useEffect( () => {
19+
window.scrollTo(0, 0);
20+
21+
const lenis = new Lenis();
22+
const raf = (time: number) => {
23+
lenis.raf(time);
24+
requestAnimationFrame(raf);
25+
}
26+
requestAnimationFrame(raf);
27+
}, []);
1728
const mainText = "Blender"
1829
const textDesc = "Blender is a program for designing 3d models and renders. I make all of my models and renders here. I take alot of inspiration from media I watch. Here is some of my work in this program."
1930
return (

src/app/(pages)/page3/page.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import React from "react";
44
import Link from 'next/link';
5+
import Slider from "@/Components/slider";
56
//import Image from "next/image";
67

78
export default function Home() {
@@ -16,6 +17,12 @@ const mainText = "Games"
1617
</div>
1718
<h1 className=" h-[45vh] flex justify-center items-center text-[15vw] font-bold md:h-[45vh] md:flex md:justify-center md:items-center md:text-[15vw] md:font-bold ">{mainText}</h1>
1819
<p className="h-[10vh] flex justify-center pr-20 pl-20 items-center text-[5vw] font-bold md:h-[20vh] md:flex md:justify-center md:pr-80 md:pl-80 md:items-center md:text-[2vw] md:font-bold">{textDesc} </p>
20+
21+
<h1 className="h-[50vh] flex justify-center items-center text-[10vw] pt-[50vh] font-bold">City Case</h1>7
22+
<div className="p-10">
23+
<Slider />
24+
</div>
25+
1926
<footer>
2027

2128
</footer>

tsconfig.json

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"compilerOptions": {
3-
"lib": ["dom", "dom.iterable", "esnext"],
3+
"lib": [
4+
"dom",
5+
"dom.iterable",
6+
"esnext"
7+
],
48
"allowJs": true,
59
"skipLibCheck": true,
610
"strict": true,
@@ -18,9 +22,18 @@
1822
}
1923
],
2024
"paths": {
21-
"@/*": ["./src/*"]
22-
}
25+
"@/*": ["./src/*"],
26+
"@assets/*": ["./src/Components/assets/*"]
27+
},
28+
"target": "ES2017"
2329
},
24-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25-
"exclude": ["node_modules"]
30+
"include": [
31+
"next-env.d.ts",
32+
"**/*.ts",
33+
"**/*.tsx",
34+
".next/types/**/*.ts"
35+
],
36+
"exclude": [
37+
"node_modules"
38+
]
2639
}

0 commit comments

Comments
 (0)