Skip to content

Commit

Permalink
Merge pull request #37 from imadityayadav/main
Browse files Browse the repository at this point in the history
#23 Created a doctors Profile Page
  • Loading branch information
yazdanhaider authored Oct 15, 2024
2 parents 43e805b + 8f7c357 commit a2da8dd
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 9 deletions.
22 changes: 22 additions & 0 deletions Frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Header from './components/Header';
import Home from './components/Home';
Expand All @@ -6,10 +7,23 @@ import Patients from './components/Patients';
import Doctors from './components/Doctors';
import Admin from './components/Admin';
import Footer from './components/Footer';

import DoctorProfile from './components/DoctorProfile'

import NotFound from "./components/NotFound";
import ScrollToTopButton from "./components/ScrollToTopButton";


function App() {

const doctor = {
name: "Dr. Smith",
specialization: "Cardiologist",
experience: 15,
degrees: ["MBBS", "MD Cardiology", "PhD in Cardiovascular Medicine"],
bio: "Dr. Smith is a renowned cardiologist with over 15 years of experience. He specializes in diagnosing and treating heart-related ailments and has been recognized for his contributions to the field of cardiovascular medicine.",
image: "https://imgs.search.brave.com/M0rIpTEVNJIFqzat4f5ZKBrLIZ69zwSoLsL3LhSeVQg/rs:fit:500:0:0:0/g:ce/aHR0cHM6Ly9pbWcu/ZnJlZXBpay5jb20v/cHJlbWl1bS1waG90/by9tYWxlLWRvY3Rv/ci1jYXJ0b29uLWlt/YWdlLWlzb2xhdGVk/LXdoaXRlXzc3Njg5/NC0xMTY1MzMuanBn/P3NpemU9NjI2JmV4/dD1qcGc", // Replace with actual image URL
};
return (
<Router>
<div className="bg-gray-100 min-h-screen font-sans">
Expand All @@ -18,6 +32,14 @@ function App() {
<Routes>
<Route path="/" element={<Home />} />
<Route path="/appointments" element={<Appointments />} />
<Route path="/profile" element={<DoctorProfile
name={doctor.name}
specialization={doctor.specialization}
experience={doctor.experience}
degrees={doctor.degrees}
bio={doctor.bio}
image={doctor.image}
/>} />
<Route path="/patients" element={<Patients />} />
<Route path="/doctors" element={<Doctors />} />
<Route path="/admin" element={<Admin />} />
Expand Down
32 changes: 32 additions & 0 deletions Frontend/src/components/DoctorProfile.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";

const DoctorProfile = ({ name, specialization, experience, degrees, bio, image }) => {
return (
<div className="flex flex-col items-center bg-gray-50 py-8 px-6 rounded-lg shadow-md max-w-md mx-auto mt-10">

{/* Doctor's Image */}
<img
className="w-40 h-40 object-cover rounded-full mb-4"
src={image}
alt={`Dr. ${name}`}
/>
{/* Doctor's Name */}
<h1 className="text-3xl font-semibold text-gray-800 mb-2">Dr. {name}</h1>
{/* Doctor's Specialization */}
<p className="text-xl text-gray-600 mb-4">{specialization}</p>
{/* Experience */}
<p className="text-lg text-gray-500 mb-2">Experience: {experience} years</p>
{/* Degrees */}
<h2 className="text-lg font-semibold text-gray-700 mb-2">Degrees:</h2>
<ul className="list-disc list-inside mb-4 text-gray-600">
{degrees.map((degree, index) => (
<li key={index}>{degree}</li>
))}
</ul>
{/* Bio */}
<p className="text-gray-600 mb-4 text-center">{bio}</p>
</div>
);
};

export default DoctorProfile;
20 changes: 11 additions & 9 deletions Frontend/src/components/Doctors.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import React, { useState } from 'react';
import { useNavigate } from 'react-router-dom';

const Doctors = () => {
const [doctors, setDoctors] = useState([
{ id: 1, name: "Dr. Smith", specialty: "Cardiology", patients: 0 },
{ id: 2, name: "Dr. Johnson", specialty: "Pediatrics", patients: 0 },
{ id: 3, name: "Dr. Williams", specialty: "Orthopedics", patients: 0 },
{ id: 4, name: "Dr. Brown", specialty: "Neurology", patients: 0 },
{ id: 5, name: "Dr. Taylor", specialty: "Dermatology", patients: 0 },
{ id: 6, name: "Dr. Wilson", specialty: "General Medicine", patients: 0 },
]);
const navigate = useNavigate();
const [doctors, setDoctors] = useState([
{ id: 1, name: "Dr. Smith", specialty: "Cardiology", patients: 0 },
{ id: 2, name: "Dr. Johnson", specialty: "Pediatrics", patients: 0 },
{ id: 3, name: "Dr. Williams", specialty: "Orthopedics", patients: 0 },
{ id: 4, name: "Dr. Brown", specialty: "Neurology", patients: 0 },
{ id: 5, name: "Dr. Taylor", specialty: "Dermatology", patients: 0 },
{ id: 6, name: "Dr. Wilson", specialty: "General Medicine", patients: 0 },
]);

return (
<section className="bg-gray-100 p-6 rounded-lg shadow-lg max-w-6xl mx-auto mt-10">
Expand All @@ -20,7 +22,7 @@ const Doctors = () => {
<p className="text-gray-600">Specialty: {doctor.specialty}</p>
<p className="text-gray-600">Patients: {doctor.patients}</p>
<button
onClick={() => alert(`More about ${doctor.name}`)}
onClick={() => navigate('/profile')}
className="mt-4 w-full bg-green-600 text-white p-2 rounded-lg hover:bg-green-500 transition duration-200"
>
View Details
Expand Down

0 comments on commit a2da8dd

Please sign in to comment.