API, Backend & Frontend
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import React from 'react';
|
||||
import './MedicineResults.css';
|
||||
|
||||
function MedicineResults({ medicines, onSelect, query }) {
|
||||
if (medicines.length === 0 && query.length >= 2) {
|
||||
return (
|
||||
<div className="no-results">
|
||||
<p>No medicines found matching "{query}"</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="medicine-results">
|
||||
{medicines.map((medicine) => (
|
||||
<div
|
||||
key={medicine.id}
|
||||
className="medicine-card"
|
||||
onClick={() => onSelect(medicine)}
|
||||
>
|
||||
<div className="medicine-card-header">
|
||||
<h3>{medicine.name}</h3>
|
||||
</div>
|
||||
<div className="medicine-card-body">
|
||||
<p><strong>Active Ingredient:</strong> {medicine.active_ingredient}</p>
|
||||
<p><strong>Dosage:</strong> {medicine.dosage} • <strong>Form:</strong> {medicine.form}</p>
|
||||
</div>
|
||||
<div className="medicine-card-footer">
|
||||
<span className="view-pharmacies">View pharmacies →</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default MedicineResults;
|
||||
|
||||
Reference in New Issue
Block a user