Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import React from 'react'
import ExpansionPanel from '@material-ui/core/ExpansionPanel'
import ExpansionPanelSummary from '@material-ui/core/ExpansionPanelSummary'
import ExpansionPanelDetails from '@material-ui/core/ExpansionPanelDetails'
import { withStyles } from '@material-ui/core/styles'
import StyledIcon from 'components/CommonKit/Icon/StyledIcon'
import ChevronOffIcon from 'assets/icons/ico/chevron-off.svg'
interface GenericExpansionPanelProps {
summary: React.ReactFragment
details: React.ReactFragment
expanded: boolean
onChange: (event: React.ChangeEvent<{}>, expanded: boolean) => void
}
const BaseExpansionPanel = withStyles({
root: {
display: 'block',
width: '90%',
margin: '0.5em auto 0.5em auto',
},
})(ExpansionPanel)
const StyledExpansionPanel = withStyles({
root: {
background: 'linear-gradient(180deg, #323339 0%, #25262B 100%)',
},
expanded: {
background: 'var(--greyBright)',
},
})(BaseExpansionPanel)
const StyledExpansionPanelSummary = withStyles({
root: {
color: 'var(--textWhite)',
minHeight: '5rem',
padding: '0 53px 0 15px',
margin: '0',
},
expanded: {
fontWeight: 'bold',
color: 'var(--textBlack)',
},
content: {
fontFamily: 'var(--textFont)',
},
})(ExpansionPanelSummary)
const StyledExpansionPanelDetails = withStyles({
root: {
color: 'var(--textBlack)',
flexDirection: 'column',
margin: '0',
padding: '0 15px 0 15px',
paddingBottom: '15px',
},
})(ExpansionPanelDetails)
const GenericExpansionPanel: React.ComponentType<GenericExpansionPanelProps> = props => {
return (
<>
<StyledExpansionPanel
expanded={props.expanded}
onChange={props.onChange}
{...props}
>
<StyledExpansionPanelSummary
expandIcon={<StyledIcon icon={ChevronOffIcon} />}
>
{props.summary}
</StyledExpansionPanelSummary>
<StyledExpansionPanelDetails>
{props.details}
</StyledExpansionPanelDetails>
</StyledExpansionPanel>
</>
)
}
export default GenericExpansionPanel