Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FileUpload extends Component {
- // other stuff omitted
- constructor(props) {
- super(props);
- this.state = {
- activeAccordionIndex: -1
- };
- handleAccordionClick = (e, titleProps) => {
- const { index } = titleProps;
- const { activeAccordionIndex } = this.state;
- const newIndex = activeAccordionIndex === index ? -1 : index;
- this.setState({
- activeAccordionIndex: newIndex
- })
- }
- // I'm using a small helper function to create the accordion and invoke it in
- // the render method, just one item for brevity; the other entries are pretty
- // much the same
- getAccordionInputs() {
- const { activeAccordionIndex } = this.state;
- let accordionContent = (
- <Accordion fluid exclusive={false}>
- <Accordion.Title
- className="file-upload-ordinal-accord-title"
- active={activeAccordionIndex === 0}
- index={0}
- onClick={this.handleAccordionClick}
- >
- <Icon name='dropdown' />
- Enter Ordinal Features
- <Popup
- on="click"
- position="right center"
- header="Ordinal Features Help"
- content={
- <div className="content">
- <p>Ordinal Features help description</p>
- </div>
- }
- trigger={
- <Icon
- className="file-upload-ordinal-help-icon"
- inverted
- size="large"
- color="orange"
- name="info circle"
- />
- }
- />
- </Accordion.Title>
- <Accordion.Content
- active={activeAccordionIndex === 0}
- >
- <textarea
- className="file-upload-ordinal-text-area"
- id="ordinal_features_text_area_input"
- label="Ordinal Features"
- placeholder={"{"ord_feat_1": ["MALE", "FEMALE"], "ord_feat_2": ["FIRST", "SECOND", "THIRD"]}"}
- onChange={this.handleOrdinalFeatures}
- />
- </Accordion.Content>
- </Accordion>
- )
- return accordionContent;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement