Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add carousel #25

Merged
merged 2 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading