react-bootstrap#PanelGroup JavaScript Examples

The following examples show how to use react-bootstrap#PanelGroup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InformationPanelContainer.jsx    From mapstore2-cadastrapp with GNU General Public License v3.0 6 votes vote down vote up
export default function InformationPanelContainer({ items = [], authLevel, additionalData = {}, infoLoading = []}) {
    const [selectedPanel, togglePanel] = useAccordionState();
    const [firstToggle, setFirstToggle] = useState(false);
    // Open first result on startup.
    useEffect(() => {
        if (!firstToggle && items.length > 0) {
            setFirstToggle(true);
            togglePanel("0");

        }
    }, [items]);
    return (<PanelGroup
        onSelect={i => togglePanel(i)}
    >{
            items.map((r, index) => {
                let header = (<div
                    onClick={() => { togglePanel(index); }}
                    className={`information-panel-title ${selectedPanel[index] ? 'selected' : 'unselected'}`}>
                    {r.parcelle}
                    {infoLoading[r?.parcelle] ? <div style={{ "float": "right" }}><Spinner spinnerName="circle" noFadeIn overrideSpinnerClassName="spinner" /></div> : null}
                </div>);
                return (
                    <Panel
                        expanded={!!selectedPanel[index.toString()]}
                        className="mapstore-side-card ms-sm"
                        collapsible
                        eventKey={index.toString()}
                        header={header}>
                        <InformationContent {...r} authLevel={authLevel} additionalData={additionalData}/>
                    </Panel>
                );
            })
        }
    </PanelGroup>);
}
Example #2
Source File: Description.jsx    From mapstore2-cadastrapp with GNU General Public License v3.0 6 votes vote down vote up
function PanelContainer({ article40 = [], article50 = [], article60 = [] }) {
    const [selectedPanel, togglePanel] = useAccordionState();
    const [firstToggle, setFirstToggle] = useState(false);
    const items = article40.map(i => ({ articleType: "article40", ...i}))
        .concat(article50.map(i => ({ articleType: "article50", ...i })))
        .concat(article60.map(i => ({ articleType: "article60", ...i })));
    // Open first result on startup.
    useEffect(() => {
        if (!firstToggle && items.length > 0) {
            setFirstToggle(true);
            togglePanel("0");

        }
    }, [items]);
    return (<PanelGroup
        onSelect={i => togglePanel(i)}
    >{
            // example of no data : 350238000AD0055 --> Batiment T
            items.length === 0 ? <Message msgId="cadastrapp.nodata" /> : items.map((r, index) => {
                let header = <div onClick={() => { togglePanel(index); }} className={`information-panel-title ${selectedPanel[index] ? 'selected' : 'unselected'}`}><ArticleHeader {...r}/></div>;
                return (
                    <Panel
                        expanded={!!selectedPanel[index.toString()]}
                        className="mapstore-side-card ms-sm"
                        collapsible
                        eventKey={index.toString()}
                        header={header}>
                        <ArticlePanel {...r} />
                    </Panel>
                );
            })
        }
    </PanelGroup>);
}