@@ -14,6 +14,9 @@ const propTypes = {
14
14
/** The text to display in the title of the section */
15
15
title : PropTypes . string . isRequired ,
16
16
17
+ /** The text to display in the subtitle of the section */
18
+ subtitle : PropTypes . string ,
19
+
17
20
/** The icon to display along with the title */
18
21
icon : PropTypes . func ,
19
22
@@ -27,6 +30,18 @@ const propTypes = {
27
30
// eslint-disable-next-line react/forbid-prop-types
28
31
containerStyles : PropTypes . arrayOf ( PropTypes . object ) ,
29
32
33
+ /** Customize the Section container */
34
+ // eslint-disable-next-line react/forbid-prop-types
35
+ titleStyles : PropTypes . arrayOf ( PropTypes . object ) ,
36
+
37
+ /** Customize the Section container */
38
+ // eslint-disable-next-line react/forbid-prop-types
39
+ subtitleStyles : PropTypes . arrayOf ( PropTypes . object ) ,
40
+
41
+ /** Customize the Section container */
42
+ // eslint-disable-next-line react/forbid-prop-types
43
+ childrenStyles : PropTypes . arrayOf ( PropTypes . object ) ,
44
+
30
45
/** Customize the Icon container */
31
46
// eslint-disable-next-line react/forbid-prop-types
32
47
iconContainerStyles : PropTypes . arrayOf ( PropTypes . object ) ,
@@ -39,21 +54,24 @@ const defaultProps = {
39
54
IconComponent : null ,
40
55
containerStyles : [ ] ,
41
56
iconContainerStyles : [ ] ,
57
+ titleStyles : [ ] ,
58
+ subtitleStyles : [ ] ,
59
+ childrenStyles : [ ] ,
60
+ subtitle : null ,
42
61
} ;
43
62
44
- function Section ( props ) {
45
- const IconComponent = props . IconComponent ;
63
+ function Section ( { children, childrenStyles, containerStyles, icon, IconComponent, iconContainerStyles, menuItems, subtitle, subtitleStyles, title, titleStyles} ) {
46
64
return (
47
65
< >
48
- < View style = { [ styles . pageWrapper , styles . cardSection , ...props . containerStyles ] } >
49
- < View style = { [ styles . flexRow , styles . alignItemsCenter , styles . w100 ] } >
66
+ < View style = { [ styles . pageWrapper , styles . cardSection , ...containerStyles ] } >
67
+ < View style = { [ styles . flexRow , styles . alignItemsCenter , styles . w100 , ... titleStyles ] } >
50
68
< View style = { [ styles . flexShrink1 ] } >
51
- < Text style = { [ styles . textHeadline , styles . cardSectionTitle ] } > { props . title } </ Text >
69
+ < Text style = { [ styles . textHeadline , styles . cardSectionTitle ] } > { title } </ Text >
52
70
</ View >
53
- < View style = { [ styles . flexGrow1 , styles . flexRow , styles . justifyContentEnd , ...props . iconContainerStyles ] } >
54
- { Boolean ( props . icon ) && (
71
+ < View style = { [ styles . flexGrow1 , styles . flexRow , styles . justifyContentEnd , ...iconContainerStyles ] } >
72
+ { Boolean ( icon ) && (
55
73
< Icon
56
- src = { props . icon }
74
+ src = { icon }
57
75
height = { 68 }
58
76
width = { 68 }
59
77
/>
@@ -62,9 +80,15 @@ function Section(props) {
62
80
</ View >
63
81
</ View >
64
82
65
- < View style = { [ styles . w100 ] } > { props . children } </ View >
83
+ { Boolean ( subtitle ) && (
84
+ < View style = { [ styles . flexRow , styles . alignItemsCenter , styles . w100 , styles . mt4 , ...subtitleStyles ] } >
85
+ < Text style = { styles . textNormal } > { subtitle } </ Text >
86
+ </ View >
87
+ ) }
88
+
89
+ < View style = { [ styles . w100 , ...childrenStyles ] } > { children } </ View >
66
90
67
- < View style = { [ styles . w100 ] } > { Boolean ( props . menuItems ) && < MenuItemList menuItems = { props . menuItems } /> } </ View >
91
+ < View style = { [ styles . w100 ] } > { Boolean ( menuItems ) && < MenuItemList menuItems = { menuItems } /> } </ View >
68
92
</ View >
69
93
</ >
70
94
) ;
0 commit comments