|
| 1 | +import React from 'react'; |
| 2 | +import { useLocation, useParams, Link } from 'react-router-dom'; |
| 3 | +import { FaArrowLeft } from 'react-icons/fa'; |
| 4 | +import '../css/tasks.css'; |
| 5 | + |
| 6 | +const DetailPage = () => { |
| 7 | + const { state } = useLocation(); |
| 8 | + const { id } = useParams(); |
| 9 | + const task = state || { id }; |
| 10 | + |
| 11 | + return ( |
| 12 | + <div className="container py-5"> |
| 13 | + <div className="row justify-content-center"> |
| 14 | + <div className="col-lg-8"> |
| 15 | + <div className="card shadow-lg"> |
| 16 | + <div className="card-body detail-card"> |
| 17 | + <div className="row mb-4"> |
| 18 | + <div className="col-auto"> |
| 19 | + <Link to="/tasks" className="btn btn-outline-secondary btn-sm"> |
| 20 | + <FaArrowLeft className="me-2" /> |
| 21 | + Back to Tasks |
| 22 | + </Link> |
| 23 | + </div> |
| 24 | + </div> |
| 25 | + <div className="text-center mb-4"> |
| 26 | + <h3>Task Details</h3> |
| 27 | + </div> |
| 28 | + <div className="mb-3"> |
| 29 | + <h5 className="m-0">Task:</h5> |
| 30 | + <p className="m-0">{task.task}</p> |
| 31 | + </div> |
| 32 | + <div className="mb-3"> |
| 33 | + <h5 className="m-0">Status:</h5> |
| 34 | + <p className={`m-0 ${task.completed ? 'text-success' : 'text-warning'}`}> |
| 35 | + {task.completed ? 'Completed' : 'Pending'} |
| 36 | + </p> |
| 37 | + </div> |
| 38 | + <div> |
| 39 | + <h5 className="m-0">Created At:</h5> |
| 40 | + <p className="m-0">{task.taskCreatedAt}</p> |
| 41 | + </div> |
| 42 | + </div> |
| 43 | + </div> |
| 44 | + </div> |
| 45 | + </div> |
| 46 | + </div> |
| 47 | + ); |
| 48 | +} |
| 49 | + |
| 50 | +export default DetailPage; |
0 commit comments