Merge branch 'master' into react-list-form

This commit is contained in:
Ryan Schouten (SharePoint Knight) 2020-09-22 21:16:04 -07:00 committed by GitHub
commit a88446b088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 20 deletions

View File

@ -58,7 +58,6 @@ Version|Date|Comments
1.5|September 1, 2020|Adds ability to click on expanded section headers to collapse accordions
1.6|September 2, 2020|Added Web Part Title, and ability to expand multiple sections
## Disclaimer
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**

View File

@ -54,7 +54,8 @@ export default class ReactAccordion extends React.Component<IReactAccordionProps
this.getListItems();
}
if (prevProps.allowMultipleExpanded !== this.props.allowMultipleExpanded || prevProps.allowZeroExpanded !== this.props.allowZeroExpanded) {
if(prevProps.allowMultipleExpanded !== this.props.allowMultipleExpanded || prevProps.allowZeroExpanded !== this.props.allowZeroExpanded) {
this.setState({
allowMultipleExpanded: this.props.allowMultipleExpanded,
allowZeroExpanded: this.props.allowZeroExpanded
@ -63,7 +64,7 @@ export default class ReactAccordion extends React.Component<IReactAccordionProps
}
public render(): React.ReactElement<IReactAccordionProps> {
const listSelected: boolean = typeof this.props.listId !== "undefined" && this.props.listId.length > 0;
const listSelected:boolean = typeof this.props.listId !== "undefined" && this.props.listId.length > 0;
const { allowMultipleExpanded, allowZeroExpanded } = this.state;
return (
<div className={styles.reactAccordion}>
@ -76,29 +77,29 @@ export default class ReactAccordion extends React.Component<IReactAccordionProps
onConfigure={this.props.onConfigure} />
}
{listSelected &&
<div>
<WebPartTitle displayMode={this.props.displayMode}
title={this.props.accordionTitle}
updateProperty={this.props.updateProperty}
/>
<Accordion allowZeroExpanded={allowZeroExpanded} allowMultipleExpanded={allowMultipleExpanded}>
{this.state.items.map((item: any) => {
return (
<AccordionItem>
<AccordionItemHeading>
<AccordionItemButton>
{item.Title}
</AccordionItemButton>
</AccordionItemHeading>
<div>
<WebPartTitle displayMode={this.props.displayMode}
title={this.props.accordionTitle}
updateProperty={this.props.updateProperty}
/>
<Accordion allowZeroExpanded={allowZeroExpanded} allowMultipleExpanded={allowMultipleExpanded}>
{this.state.items.map((item:any) => {
return (
<AccordionItem>
<AccordionItemHeading>
<AccordionItemButton>
{item.Title}
</AccordionItemButton>
</AccordionItemHeading>
<AccordionItemPanel>
<p dangerouslySetInnerHTML={{ __html: item.Content }} />
</AccordionItemPanel>
</AccordionItem>
);
})
}
</Accordion>
</div>
}
</Accordion>
</div>
}
</div>
);