1- import React from 'react' ;
1+ import React , { useState } from 'react' ;
22import { Divider , Typography } from '@mui/material' ;
33import { HBox , VBox } from '@/ui/shared-components/LayoutBoxes' ;
44import theme from '@/theme' ;
@@ -7,6 +7,8 @@ import { useSelectedBenefitStore, useSelectedTopicsStore } from "@/ui/storage/zu
77import EligibilityOverviewTag from './EligibilityOverviewTag' ;
88import EligibilityOverviewBanner from './EligibilityOverviewBanner' ;
99import ChevronRightIcon from '@mui/icons-material/ChevronRight' ;
10+ import AddIcon from '@mui/icons-material/Add' ;
11+ import RemoveIcon from '@mui/icons-material/Remove' ;
1012
1113const filterKeys = [
1214 'benefitCategories' ,
@@ -16,6 +18,7 @@ const filterKeys = [
1618] ;
1719
1820const EligibilityOverviewItem = ( { t, item, eligible } ) => {
21+ const [ isVisible , setIsVisible ] = useState ( false ) ;
1922 const color = eligible === 'indeterminate' ? 'black.light' : 'black.main' ;
2023 const setSelectedBenefit = useSelectedBenefitStore ( ( state ) => state . setSelectedBenefit ) ;
2124 const clearSelectedTopics = useSelectedTopicsStore ( ( state ) => state . clear ) ;
@@ -45,35 +48,55 @@ const EligibilityOverviewItem = ({ t, item, eligible }) => {
4548 gap : 1
4649 } }
4750 >
48- < VBox sx = { { gap : 2 } } >
49- < HBox sx = { { alignItems : 'flex-end' , gap : 2 , flexWrap : 'wrap' } } >
50- < Typography variant = 'h2' sx = { { color : color , fontWeight : '400' , wordBreak : 'break-word' } } >
51- { item . title }
52- </ Typography >
53- { item . status === "beta" && (
54- < Typography variant = 'body1' sx = { { color : 'blue.main' } } >
55- Beta
51+ < VBox sx = { { gap : 2 , width : '100%' } } >
52+ < HBox sx = { { alignItems : 'flex-end' , gap : 2 , flexWrap : 'wrap' , width : '100%' } } >
53+ < HBox sx = { { alignItems : 'center' , justifyContent : 'space-between' , width : '100%' } } >
54+ < HBox sx = { { alignItems : 'center' , gap : 2 , flexWrap : 'wrap' } } >
55+ < Typography variant = 'h2' sx = { { color : color , fontWeight : '400' , wordBreak : 'break-word' } } >
56+ { item . title }
57+ </ Typography >
58+ { item . status === "beta" && (
59+ < Typography variant = 'body1' sx = { { color : 'blue.main' } } >
60+ Beta
61+ </ Typography >
62+ ) }
63+ </ HBox >
64+ {
65+ ! isVisible ? (
66+ < AddIcon
67+ sx = { { fontSize : '24px' } }
68+ onClick = { ( ) => setIsVisible ( true ) }
69+ />
70+ ) : (
71+ < RemoveIcon
72+ sx = { { fontSize : '24px' } }
73+ onClick = { ( ) => setIsVisible ( false ) }
74+ /> )
75+ }
76+ </ HBox >
77+ { isVisible && (
78+ < Typography variant = "body1" sx = { { wordBreak : 'break-word' } } >
79+ { item . description }
5680 </ Typography >
5781 ) }
5882 </ HBox >
59- < Typography variant = "body1" sx = { { wordBreak : 'break-word' } } >
60- { item . description }
61- </ Typography >
6283 </ VBox >
6384 </ HBox >
6485 </ HBox >
6586 < VBox sx = { { gap : 2 } } >
66- < HBox sx = { { flexWrap : 'wrap' , gap : 1 } } >
67- {
68- filterKeys . flatMap ( key => (
69- item [ key ] && (
70- item [ key ] . map ( tag => (
71- < EligibilityOverviewTag key = { tag . id } tag = { tag . label } tagType = { key } />
72- ) )
73- )
74- ) )
75- }
76- </ HBox >
87+ { isVisible && (
88+ < HBox sx = { { flexWrap : 'wrap' , gap : 1 } } >
89+ {
90+ filterKeys . flatMap ( key => (
91+ item [ key ] && (
92+ item [ key ] . map ( tag => (
93+ < EligibilityOverviewTag key = { tag . id } tag = { tag . label } tagType = { key } />
94+ ) )
95+ )
96+ ) )
97+ }
98+ </ HBox >
99+ ) }
77100 < Divider sx = { { color : 'dark.light' , borderStyle : 'dashed' } } />
78101 < HBox sx = { { flexWrap : 'wrap' , gap : 2 , alignItems : 'center' } } >
79102 {
@@ -93,7 +116,7 @@ const EligibilityOverviewItem = ({ t, item, eligible }) => {
93116 text = { 'app.browseAll.checkElBtn' }
94117 link = { `/onboarding-welcome/${ item . id } ` }
95118 size = 'small'
96- endIcon = { < ChevronRightIcon sx = { { fontSize : '16px' } } /> }
119+ endIcon = { < ChevronRightIcon sx = { { fontSize : '16px' } } /> }
97120 />
98121
99122 }
0 commit comments