Skip to content

Commit

Permalink
Merge pull request #25 from OnCampus-Community/carousel
Browse files Browse the repository at this point in the history
add carousel
  • Loading branch information
AdityaSingh-02 authored Oct 12, 2023
2 parents be29378 + 6d936cc commit f8b5d70
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 11 deletions.
27 changes: 24 additions & 3 deletions src/components/Fourth/fourth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,32 @@ export const Fourth = () => {
text: "Hello world",
});

const [keyId, setKey] = useState<number>(1);

useEffect(() => {
setTimeout(() => {
setReviews(revs.rev1);
}, 3000);
}, []);
getIndex(revs.rev1.key);
if (keyId == 1) {
setReviews(revs.rev1);
} else if (keyId == 2) {
setReviews(revs.rev2);
} else if (keyId == 3) {
setReviews(revs.rev3);
} else {
setReviews(revs.rev4);
}
}, 5000);
}, [keyId]);

const getIndex = (num: number) => {
setKey((prev)=>{
if(prev == 4){
return prev = 1
}else{
return prev +=1;
}
})
};

return (
<div className={style.fourth}>
Expand Down
20 changes: 12 additions & 8 deletions src/components/Fourth/reviews.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
{
"rev1": {
"key":1,
"im": "/person.png",
"name": "joshua",
"name": "John Doe",
"position": "marketing",
"text": "Hello this is johua"
"text": "Hello this is John Doe"
},
"rev2": {
"key":2,
"im": "/person.png",
"name": "joshua sam",
"name": "Foo",
"position": "marketing",
"text": "Hello this is johua"
"text": "Hello this is foo"
},
"rev3": {
"key":3,
"im": "/person.png",
"name": "joshua singh",
"name": "Bar",
"position": "marketing",
"text": "Hello this is johua"
"text": "Hello this is Bar"
},
"rev4": {
"key":4,
"im": "/person.png",
"name": "joshua jodd",
"name": "NextJs",
"position": "marketing",
"text": "Hello this is johua"
"text": "Hello this is NexTJs"
}
}
1 change: 1 addition & 0 deletions src/components/Slides/slide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Props {
name: string;
position: string;
text: string;
key?: number;
}

export const slide = (props: Props) => {
Expand Down

0 comments on commit f8b5d70

Please sign in to comment.