UNPKG

@shopgate/engage

Version:
36 lines (35 loc) 951 B
import React from 'react'; import PropTypes from 'prop-types'; import { useWidgetSettings, useCurrentProduct } from "../../../core"; import RelationsSliderContent from "./RelationsSliderContent"; import { WIDGET_ID } from "./constants"; /** * Renders the relations slider in the desired position on the Product Detail Page. * @param {string} desiredPosition The position the relations slider needs to render. * @returns {JSX} */ import { jsx as _jsx } from "react/jsx-runtime"; const RelationsSlider = ({ desiredPosition }) => { const { type, position } = useWidgetSettings(WIDGET_ID); const { productId } = useCurrentProduct(); if (!type || position !== desiredPosition) { return null; } return /*#__PURE__*/_jsx(RelationsSliderContent, { productId: productId, type: type, max: 10, limit: 100 }); }; RelationsSlider.defaultProps = { desiredPosition: 'header' }; export default RelationsSlider;