-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React, { useEffect } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { Link } from 'react-router-dom'; | ||
import Slider from 'react-slick'; | ||
import { fetchdoctors } from '../redux/doctors/doctorSlice'; | ||
import 'slick-carousel/slick/slick.css'; | ||
import 'slick-carousel/slick/slick-theme.css'; | ||
|
||
const Test = () => { | ||
const doctorsDispatch = useDispatch(); | ||
|
||
const allDoctors = useSelector((state) => state.doctors); | ||
const finalDoctorsData = allDoctors.doctors; | ||
|
||
useEffect(() => { | ||
doctorsDispatch(fetchdoctors()); | ||
}, [doctorsDispatch]); | ||
|
||
const settings = { | ||
dots: true, | ||
infinite: true, | ||
speed: 500, | ||
slidesToShow: 3, | ||
slidesToScroll: 1, | ||
}; | ||
|
||
return ( | ||
<> | ||
<Slider {...settings}> | ||
{finalDoctorsData.map((item) => ( | ||
|
||
<Link to={`/doctor/${item.id}`} className="flex border w-auto justify-center items-center h-[250px] flex-col bg-[blue]" key={item.id}> | ||
<img src={item.photo_url} alt={item.name} /> | ||
|
||
</Link> | ||
|
||
))} | ||
</Slider> | ||
</> | ||
); | ||
}; | ||
|
||
export default Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters