Advertisement
shadiff

benfits 1page.

Sep 14th, 2023
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. import React, { useState } from 'react';
  2.  
  3. const Benefits = () => {
  4. const [selectedCategory, setSelectedCategory] = useState(null);
  5.  
  6. const handleCategoryClick = (category) => {
  7. setSelectedCategory(category);
  8. // Update the eligible dependents based on the selected category here.
  9. // You can implement this logic based on your data structure.
  10. };
  11.  
  12. return (
  13. <>
  14. <div className='categories-table'>
  15. <table>
  16. <thead>
  17. <tr>
  18. <th>Categories</th>
  19. </tr>
  20. </thead>
  21.  
  22. <tbody>
  23. <tr style={{ cursor: 'pointer' }} onClick={() => handleCategoryClick('Category A')}>
  24. <td>Category A</td>
  25. </tr>
  26.  
  27. <tr style={{ cursor: 'pointer' }} onClick={() => handleCategoryClick('Category B')}>
  28. <td>Category B</td>
  29. </tr>
  30.  
  31. <tr style={{ cursor: 'pointer' }} onClick={() => handleCategoryClick('Category C')}>
  32. <td>Category C</td>
  33. </tr>
  34. </tbody>
  35. </table>
  36.  
  37. {/* End of Table 1 */}
  38. <table>
  39. <thead>
  40. <tr>
  41. <th>Category Benefits</th>
  42. <th>Eligible Dependents</th>
  43. </tr>
  44. </thead>
  45.  
  46. <tbody>
  47. <tr>
  48. <td>Outpatient</td>
  49. <td>{selectedCategory === 'Category A' ? 2 : null}</td>
  50. </tr>
  51. <tr>
  52. <td>Inpatient</td>
  53. <td>{selectedCategory === 'Category A' ? 4 : null}</td>
  54. </tr>
  55. <tr>
  56. <td>Optical</td>
  57. <td>{selectedCategory === 'Category A' ? 6 : null}</td>
  58. </tr>
  59. <tr>
  60. <td>Dental</td>
  61. <td>{selectedCategory === 'Category A' ? 8 : null}</td>
  62. </tr>
  63. </tbody>
  64. </table>
  65. </div>
  66. {/* End of Table 2 */}
  67. </>
  68. );
  69. };
  70.  
  71. export default Benefits;
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement