|
1 | | -import React, { useState } from 'react'; |
2 | | -import { Add, Remove } from "@mui/icons-material"; |
3 | | -import { IconButton, Typography, Box } from '@mui/material'; |
| 1 | +import React from 'react'; |
| 2 | +import { Typography } from '@mui/material'; |
4 | 3 | import { HBox, VBox } from '@/ui/shared-components/LayoutBoxes'; |
5 | | -import EligibilityOverviewItemDetails from "./EligibilityOverviewItemDetails"; |
| 4 | +import theme from '@/theme'; |
| 5 | +import RegularButton from '@/ui/shared-components/buttons/RegularButton'; |
| 6 | +import { useSelectedBenefitStore, useSelectedTopicsStore } from "@/ui/storage/zustand"; |
6 | 7 |
|
7 | | -const EligibilityOverviewItem = ({ item, eligible, iconPath }) => { |
8 | | - const [showDescription, setShowDescription] = useState(false); |
9 | | - |
10 | | - const toggleDescription = () => { |
11 | | - setShowDescription(prevState => !prevState); |
12 | | - }; |
13 | | - |
14 | | - const marginBottom = showDescription ? '16px' : '0'; |
| 8 | +const EligibilityOverviewItem = ({ item, eligible }) => { |
15 | 9 | const color = eligible === 'indeterminate' ? 'black.light' : 'black.main'; |
| 10 | + const setSelectedBenefit = useSelectedBenefitStore((state) => state.setSelectedBenefit); |
| 11 | + const clearSelectedTopics = useSelectedTopicsStore((state) => state.clear); |
16 | 12 |
|
17 | 13 | return ( |
18 | | - <VBox sx={{ marginBottom: marginBottom }}> |
19 | | - <HBox sx={{ alignItems: "center", width: '100%' }}> |
20 | | - <img src={iconPath} alt="logo" style={{ width: "14px" }} /> |
21 | | - <HBox sx={{ width: '100%' }}> |
22 | | - <HBox sx={{ alignItems: 'center', gap:1, flexWrap: 'wrap' }}> |
23 | | - <Typography variant='h2' sx={{ color: color, fontWeight: '400', wordBreak: 'break-word' }} onClick={toggleDescription}> |
| 14 | + <VBox |
| 15 | + sx={{ |
| 16 | + display: 'flex', |
| 17 | + flexDirection: 'column', |
| 18 | + gap: 4, |
| 19 | + border: `1px solid ${theme.palette.white.dark}`, |
| 20 | + boxShadow: '0px 1px 2px rgba(0, 0, 0, 0.25)', |
| 21 | + padding: 2, |
| 22 | + borderRadius: theme.shape.borderRadius, |
| 23 | + }} |
| 24 | + > |
| 25 | + <HBox |
| 26 | + sx={{ |
| 27 | + display: 'flex', |
| 28 | + flex: '1 1 auto', |
| 29 | + width: '100%', |
| 30 | + justifyContent: 'flex-start', |
| 31 | + }} |
| 32 | + > |
| 33 | + <HBox |
| 34 | + sx={{ |
| 35 | + flex: '1 1 0%', |
| 36 | + alignItems: 'flex-start', |
| 37 | + gap: 1 |
| 38 | + }} |
| 39 | + > |
| 40 | + <VBox sx={{ gap: 2 }}> |
| 41 | + <Typography variant='h2' sx={{ color: color, fontWeight: '400', wordBreak: 'break-word' }}> |
24 | 42 | {item.title} |
25 | 43 | </Typography> |
26 | 44 | {item.status === "beta" && ( |
27 | 45 | <Typography variant='body1' sx={{ color: 'blue.main' }}> |
28 | 46 | Beta |
29 | 47 | </Typography> |
30 | 48 | )} |
31 | | - </HBox> |
| 49 | + <Typography variant="body1"> |
| 50 | + {item.description} |
| 51 | + </Typography> |
| 52 | + <HBox sx={{ gap: 1, flexWrap: 'wrap' }}> |
| 53 | + <HBox sx={{ backgroundColor: 'green.main', padding: '6px 10px', borderRadius: theme.shape.borderRadius }}> |
| 54 | + <Typography variant="body1"> |
| 55 | + Sie haben womöglich Anspruch! |
| 56 | + </Typography> |
| 57 | + </HBox> |
| 58 | + </HBox> |
| 59 | + </VBox> |
| 60 | + </HBox> |
| 61 | + <HBox |
| 62 | + sx={{ |
| 63 | + display: 'flex', |
| 64 | + flex: '1 1 0%', |
| 65 | + justifyContent: 'flex-end', |
| 66 | + }} |
| 67 | + > |
| 68 | + <VBox |
| 69 | + sx={{ |
| 70 | + gap: 8, |
| 71 | + justifyContent: 'space-between', |
| 72 | + alignItems: 'flex-end', |
| 73 | + }} |
| 74 | + > |
| 75 | + <HBox sx={{ justifyContent: 'flex-end', flexWrap: 'wrap', gap: 1 }}> |
| 76 | + <HBox sx={{ |
| 77 | + border: `1px solid ${theme.palette.green.main}`, |
| 78 | + padding: '6px 10px', |
| 79 | + borderRadius: theme.shape.borderRadius, |
| 80 | + }}> |
| 81 | + <Typography variant='body2' sx={{}}> |
| 82 | + Bundesleistung |
| 83 | + </Typography> |
| 84 | + </HBox> |
| 85 | + <HBox sx={{ |
| 86 | + border: `1px solid ${theme.palette.pink.main}`, |
| 87 | + padding: '6px 10px', |
| 88 | + borderRadius: theme.shape.borderRadius, |
| 89 | + }}> |
| 90 | + <Typography variant='body2' sx={{}}> |
| 91 | + Agentur für Arbeit |
| 92 | + </Typography> |
| 93 | + </HBox> |
| 94 | + <HBox sx={{ |
| 95 | + border: `1px solid ${theme.palette.blue.main}`, |
| 96 | + padding: '6px 10px', |
| 97 | + borderRadius: theme.shape.borderRadius, |
| 98 | + }}> |
| 99 | + <Typography variant='body2' sx={{}}> |
| 100 | + Rehaibilitierung und Teilhabe |
| 101 | + </Typography> |
| 102 | + </HBox> |
| 103 | + </HBox> |
| 104 | + <HBox sx={{ gap: 2, flexWrap: 'wrap' }}> |
| 105 | + <RegularButton |
| 106 | + variant={'blueHollow'} |
| 107 | + text={'app.browseAll.learnMoreBtn'} |
| 108 | + link={`/benefit-page/${item.id}`} |
| 109 | + size='small' |
| 110 | + /> |
| 111 | + {eligible === 'indeterminate' && |
| 112 | + <RegularButton |
| 113 | + variant={'pinkContained'} |
| 114 | + onClick={() => { |
| 115 | + clearSelectedTopics() |
| 116 | + setSelectedBenefit(item.id); |
| 117 | + }} |
| 118 | + text={'app.browseAll.checkElBtn'} |
| 119 | + link={`/onboarding-welcome/${item.id}`} |
| 120 | + size='small' |
| 121 | + /> |
| 122 | + } |
| 123 | + </HBox> |
| 124 | + </VBox> |
32 | 125 | </HBox> |
33 | | - <Box> |
34 | | - <IconButton onClick={toggleDescription} size="small" > |
35 | | - {showDescription ? <Remove sx={{ color: color }} /> : <Add sx={{ color: color }} />} |
36 | | - </IconButton> |
37 | | - </Box> |
38 | 126 | </HBox> |
39 | | - {showDescription && ( |
40 | | - <EligibilityOverviewItemDetails item={item} eligible={eligible} /> |
41 | | - )} |
42 | 127 | </VBox> |
43 | 128 | ); |
44 | 129 | }; |
|
0 commit comments