@razorpay/blade
Version:
The Design System that powers Razorpay
64 lines (61 loc) • 2.15 kB
JavaScript
import React__default from 'react';
import { useLightBoxContext } from './LightBoxContext.js';
import { LightBoxItem } from './LightBoxItem.js';
import { LightBoxMainView } from './LightBoxMainView.web.js';
import { LightBoxThumbnailStrip } from './LightBoxThumbnailStrip.web.js';
import '../../utils/assignWithoutSideEffects/index.js';
import '../Box/index.js';
import { jsxs, jsx } from 'react/jsx-runtime';
import { Box } from '../Box/Box.js';
import { assignWithoutSideEffects } from '../../utils/assignWithoutSideEffects/assignWithoutSideEffects.js';
var _LightBoxBody = function _LightBoxBody(_ref) {
var children = _ref.children;
var _useLightBoxContext = useLightBoxContext(),
activeIndex = _useLightBoxContext.activeIndex,
handleIndexChange = _useLightBoxContext.handleIndexChange;
var items = [];
React__default.Children.forEach(children, function (child) {
if (/*#__PURE__*/React__default.isValidElement(child) && child.type === LightBoxItem) {
var _ref2 = child.props,
src = _ref2.src,
thumbnail = _ref2.thumbnail,
alt = _ref2.alt,
itemChildren = _ref2.children;
if (src) {
items.push({
src: src,
thumbnail: thumbnail !== null && thumbnail !== void 0 ? thumbnail : src,
alt: alt
});
} else if (thumbnail && itemChildren != null) {
items.push({
thumbnail: thumbnail,
alt: alt,
children: itemChildren
});
}
}
});
return /*#__PURE__*/jsxs(Box, {
display: "flex",
flexDirection: "column",
overflow: "hidden",
justifyContent: "space-between",
width: "100%",
height: "100%",
children: [/*#__PURE__*/jsx(LightBoxMainView, {
items: items,
activeIndex: activeIndex,
onChange: handleIndexChange
}), /*#__PURE__*/jsx(LightBoxThumbnailStrip, {
items: items,
activeIndex: activeIndex,
onSelect: handleIndexChange
})]
});
};
var LightBoxBody = /*#__PURE__*/assignWithoutSideEffects(_LightBoxBody, {
displayName: 'LightBoxBody'
});
export { LightBoxBody };
//# sourceMappingURL=LightBoxBody.web.js.map