1
- import { Accordion , AccordionDetails , AccordionSummary , Grid , Typography } from "@mui/material" ;
1
+ import {
2
+ Accordion ,
3
+ AccordionDetails ,
4
+ AccordionSummary ,
5
+ Grid ,
6
+ Typography ,
7
+ } from "@mui/material" ;
2
8
import React , { Dispatch , SetStateAction , useState } from "react" ;
3
9
import { AccordionWrapper , FAQWrapper } from "../styles" ;
4
- import AddIcon from ' @mui/icons-material/Add' ;
5
- import RemoveIcon from ' @mui/icons-material/Remove' ;
10
+ import AddIcon from " @mui/icons-material/Add" ;
11
+ import RemoveIcon from " @mui/icons-material/Remove" ;
6
12
import { FAQ_DATA } from "~/lib/constants" ;
7
13
8
14
interface ISimpleAccordionProps {
9
- id : number | false ,
10
- expanded : number | false ,
11
- setExpanded : Dispatch < SetStateAction < number | false > > ,
12
- title : string ,
13
- description : string ,
15
+ id : number | false ;
16
+ expanded : number | false ;
17
+ setExpanded : Dispatch < SetStateAction < number | false > > ;
18
+ title : string ;
19
+ description : string ;
14
20
}
15
21
16
22
const SimpleAccordion : React . FC < ISimpleAccordionProps > = ( props ) => {
17
-
18
- const handleChange = ( panel : number | false ) => ( event : React . SyntheticEvent < Element , Event > , isExpanded : boolean ) => {
19
- props . setExpanded ( isExpanded ? panel : false ) ;
20
- } ;
23
+ const handleChange =
24
+ ( panel : number | false ) =>
25
+ ( event : React . SyntheticEvent < Element , Event > , isExpanded : boolean ) => {
26
+ props . setExpanded ( isExpanded ? panel : false ) ;
27
+ } ;
21
28
22
29
return (
23
30
< div data-aos = "fade-up" data-aos-delay = "500" >
@@ -26,53 +33,55 @@ const SimpleAccordion: React.FC<ISimpleAccordionProps> = (props) => {
26
33
onChange = { handleChange ( props . id ) }
27
34
>
28
35
< AccordionSummary
29
- expandIcon = { props . expanded === props . id ? < RemoveIcon /> : < AddIcon /> }
36
+ expandIcon = {
37
+ props . expanded === props . id ? (
38
+ < RemoveIcon />
39
+ ) : (
40
+ < AddIcon style = { { color : "#c0d5ff" } } />
41
+ )
42
+ }
30
43
classes = { {
31
- root : ' icon' ,
32
- expanded : ' icon' ,
44
+ root : " icon" ,
45
+ expanded : " icon" ,
33
46
} }
34
47
aria-controls = "panel1a-content"
35
48
id = "panel1a-header"
36
49
>
37
- < Typography className = { ' heading' } > { props . title } </ Typography >
50
+ < Typography className = { " heading" } > { props . title } </ Typography >
38
51
</ AccordionSummary >
39
- < AccordionDetails style = { { padding : 0 } } >
40
- < Typography className = { 'description' } >
41
- { props . description }
42
- </ Typography >
52
+ < AccordionDetails style = { { padding : 0 } } >
53
+ < Typography className = { "description" } > { props . description } </ Typography >
43
54
</ AccordionDetails >
44
55
</ AccordionWrapper >
45
56
</ div >
46
- )
47
- }
57
+ ) ;
58
+ } ;
48
59
49
60
const FAQ = ( ) => {
50
-
51
61
const [ expanded , setExpanded ] = useState < number | false > ( false ) ;
52
62
53
63
return (
54
64
< FAQWrapper data-aos = "fade-up" data-aos-delay = "200" >
55
65
< Grid container >
56
- < Typography variant = "h2" gutterBottom className = { ' title' } >
66
+ < Typography variant = "h2" gutterBottom className = { " title" } >
57
67
FAQ's
58
68
</ Typography >
59
69
< Grid container >
60
70
{ FAQ_DATA . map ( ( item , index ) => (
61
- < Grid item xs = { 12 } sm = { 6 } key = { index } >
62
- { item . map ( faq => (
63
- < SimpleAccordion
64
- key = { faq . id }
65
- expanded = { expanded }
66
- setExpanded = { setExpanded }
67
- { ...faq }
68
- />
69
- ) ) }
70
- </ Grid >
71
+ < Grid item xs = { 12 } sm = { 6 } key = { index } >
72
+ { item . map ( ( faq ) => (
73
+ < SimpleAccordion
74
+ key = { faq . id }
75
+ expanded = { expanded }
76
+ setExpanded = { setExpanded }
77
+ { ...faq }
78
+ />
79
+ ) ) }
80
+ </ Grid >
71
81
) ) }
72
-
73
82
</ Grid >
74
83
</ Grid >
75
- { /* <Grid container>
84
+ { /* <Grid container>
76
85
<Typography variant="h2" gutterBottom className={classes.title}>
77
86
FAQ's
78
87
</Typography>
@@ -140,9 +149,8 @@ const FAQ = () => {
140
149
</Grid>
141
150
</Grid>
142
151
</Grid> */ }
143
-
144
152
</ FAQWrapper >
145
- )
146
- }
153
+ ) ;
154
+ } ;
147
155
148
- export default FAQ ;
156
+ export default FAQ ;
0 commit comments