@shopgate/engage
Version:
Shopgate's ENGAGE library.
45 lines (44 loc) • 1.07 kB
JavaScript
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useNavigation } from '@shopgate/engage/core/hooks';
import { HtmlSanitizer } from '@shopgate/engage/components';
/**
* Renders a single properties row with HTML content.
* @param {Object} props The component props.
* @return {JSX.Element}
*/
import { jsx as _jsx } from "react/jsx-runtime";
const RowHTML = ({
value,
label
}) => {
const {
push
} = useNavigation();
const handleClick = useCallback((pathname, target) => {
push({
pathname,
...(target && {
state: {
target
}
})
});
}, [push]);
return /*#__PURE__*/_jsx("tr", {
className: "engage__product__product-property",
"data-type": "html",
"data-label": label,
children: /*#__PURE__*/_jsx("td", {
colSpan: 2,
children: /*#__PURE__*/_jsx(HtmlSanitizer, {
settings: {
handleClick,
html: value
},
children: value
})
})
});
};
export default /*#__PURE__*/React.memo(RowHTML);