This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +52
-3
lines changed
vulcan-base-styles/lib/stylesheets Expand file tree Collapse file tree 2 files changed +52
-3
lines changed Original file line number Diff line number Diff line change @@ -127,4 +127,22 @@ div.ReactTags__suggestions mark{
127
127
& .danger {
128
128
color : #EF1642 ;
129
129
}
130
+ }
131
+
132
+ .form-section-heading {
133
+ display : flex ;
134
+ align-items : center ;
135
+ justify-content : space-between ;
136
+ cursor : pointer ;
137
+ padding-bottom : 10px ;
138
+ margin-bottom : 10px ;
139
+ border-bottom : 1px solid $light-grey ;
140
+ }
141
+
142
+ .form-section-heading-title {
143
+ margin : 0 ;
144
+ }
145
+
146
+ .form-section-collapsed {
147
+ display : none ;
130
148
}
Original file line number Diff line number Diff line change 1
1
import React , { PureComponent } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
- import FormComponent from "./FormComponent.jsx" ;
3
+ import FormComponent from './FormComponent.jsx' ;
4
+ import { Components } from 'meteor/vulcan:core' ;
5
+ import classNames from 'classnames' ;
4
6
5
7
class FormGroup extends PureComponent {
8
+
9
+ constructor ( props ) {
10
+ super ( props ) ;
11
+ this . toggle = this . toggle . bind ( this ) ;
12
+ this . renderHeading = this . renderHeading . bind ( this ) ;
13
+ this . state = {
14
+ collapsed : props . startCollapsed || false
15
+ }
16
+ }
17
+
18
+ toggle ( ) {
19
+ this . setState ( {
20
+ collapsed : ! this . state . collapsed
21
+ } )
22
+ }
23
+
24
+ renderHeading ( ) {
25
+ return (
26
+ < div className = "form-section-heading" onClick = { this . toggle } >
27
+ < h3 className = "form-section-heading-title" > { this . props . label } </ h3 >
28
+ < span className = "form-section-heading-toggle" >
29
+ { this . state . collapsed ? < Components . Icon name = "expand" /> : < Components . Icon name = "collapse" /> }
30
+ </ span >
31
+ </ div >
32
+ )
33
+ }
34
+
6
35
render ( ) {
7
36
return (
8
37
< div className = "form-section" >
9
- { this . props . name === 'default' ? null : < h3 className = "form-section-heading" > { this . props . label } </ h3 > }
10
- { this . props . fields . map ( field => < FormComponent key = { field . name } { ...field } updateCurrentValues = { this . props . updateCurrentValues } /> ) }
38
+ { this . props . name === 'default' ? null : this . renderHeading ( ) }
39
+ < div className = { classNames ( { 'form-section-collapsed' : this . state . collapsed } ) } >
40
+ { this . props . fields . map ( field => < FormComponent key = { field . name } { ...field } updateCurrentValues = { this . props . updateCurrentValues } /> ) }
41
+ </ div >
11
42
</ div >
12
43
)
13
44
}
You can’t perform that action at this time.
0 commit comments