Skip to content

Commit baca4ef

Browse files
committed
make catalog overview a little simpler
1 parent 9b7e400 commit baca4ef

2 files changed

Lines changed: 52 additions & 24 deletions

File tree

src/ui/screens/eligibilty-overview/components/EligibilityOverviewItem.js

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import { Divider, Typography } from '@mui/material';
33
import { HBox, VBox } from '@/ui/shared-components/LayoutBoxes';
44
import theme from '@/theme';
@@ -7,6 +7,8 @@ import { useSelectedBenefitStore, useSelectedTopicsStore } from "@/ui/storage/zu
77
import EligibilityOverviewTag from './EligibilityOverviewTag';
88
import EligibilityOverviewBanner from './EligibilityOverviewBanner';
99
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
10+
import AddIcon from '@mui/icons-material/Add';
11+
import RemoveIcon from '@mui/icons-material/Remove';
1012

1113
const filterKeys = [
1214
'benefitCategories',
@@ -16,6 +18,7 @@ const filterKeys = [
1618
];
1719

1820
const 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
}

src/ui/shared-components/buttons/RegularButton.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ import useTranslation from "@/ui/language/useTranslation";
55
import buttonStyles from "./ButtonStyles";
66

77
const sizeStyles = {
8+
xsmall: {
9+
padding: "4px 8px",
10+
fontSize: "12px",
11+
borderRadius: 4,
12+
},
813
small: {
914
padding: "8px 12px",
1015
fontSize: "14px",

0 commit comments

Comments
 (0)