@wulperstudio/cms
Version:
Wulper Studio Library Components CMS
45 lines • 1.86 kB
JavaScript
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["data", "paddingPanel", "containerProps", "accordionDetailsProps", "accordionSummaryProps"],
_excluded2 = ["sx"];
/* eslint-disable react/no-array-index-key */
import React from 'react';
import { Box } from '@mui/material';
import { Accordion, AccordionDetails, AccordionSummary } from './styled';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var Accordions = function Accordions(_ref) {
var data = _ref.data,
paddingPanel = _ref.paddingPanel,
containerProps = _ref.containerProps,
accordionDetailsProps = _ref.accordionDetailsProps,
accordionSummaryProps = _ref.accordionSummaryProps,
props = _objectWithoutProperties(_ref, _excluded);
var _ref2 = accordionDetailsProps || {},
sxAccordionDetailsProps = _ref2.sx,
restAccordionDetailsProps = _objectWithoutProperties(_ref2, _excluded2);
return /*#__PURE__*/_jsx(Box, Object.assign({}, containerProps, {
children: data.map(function (_ref3, i) {
var header = _ref3.header,
body = _ref3.body,
expanded = _ref3.expanded,
onChange = _ref3.onChange;
return /*#__PURE__*/_jsxs(Accordion, Object.assign({
expanded: expanded,
onChange: onChange
}, props, {
children: [/*#__PURE__*/_jsx(AccordionSummary, Object.assign({
"aria-controls": "panel".concat(i, "-content"),
id: "panel".concat(i, "-header")
}, accordionSummaryProps, {
children: header
})), /*#__PURE__*/_jsx(AccordionDetails, Object.assign({
sx: Object.assign({
padding: paddingPanel
}, sxAccordionDetailsProps)
}, restAccordionDetailsProps, {
children: body
}))]
}), i);
})
}));
};
export default Accordions;