@shopgate/engage
Version:
Shopgate's ENGAGE library.
43 lines (42 loc) • 1.1 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { tableCell } from "./style";
/**
* Renders a single properties row.
* @param {Object} props The component props.
* @return {JSX.Element}
*/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const Row = ({
label,
value,
type
}) => /*#__PURE__*/_jsxs("tr", {
className: "engage__product__product-property",
"data-type": type,
"data-label": label,
"aria-label": `${typeof label === 'string' ? label : ''}: ${typeof value === 'string' ? value : ''}`,
tabIndex: 0,
children: [/*#__PURE__*/_jsx("td", {
className: tableCell,
"aria-hidden": true,
children: /*#__PURE__*/_jsx("span", {
dangerouslySetInnerHTML: {
__html: label
}
})
}), /*#__PURE__*/_jsx("td", {
className: tableCell,
"data-test-id": `property: ${value}`,
"aria-hidden": true,
children: /*#__PURE__*/_jsx("span", {
dangerouslySetInnerHTML: {
__html: value
}
})
})]
});
Row.defaultProps = {
type: null
};
export default /*#__PURE__*/React.memo(Row);