@talend/react-components
Version:
Set of react components.
43 lines (42 loc) • 1.24 kB
JavaScript
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { SortIndicator } from 'react-virtualized';
import Icon from '../../Icon';
import theme from './HeaderIcon.module.scss';
/**
* This renderer render the header with an icon
* @param {object} props column header props
*/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
function HeaderIcon({
label,
sortBy,
dataKey,
sortDirection,
columnData
}) {
return /*#__PURE__*/_jsx("div", {
className: classnames(theme['tc-header-icon'], 'tc-header-icon'),
children: /*#__PURE__*/_jsxs("span", {
title: label,
"aria-label": label,
children: [columnData.iconName && /*#__PURE__*/_jsx(Icon, {
name: columnData.iconName
}), sortBy === dataKey && /*#__PURE__*/_jsx(SortIndicator, {
sortDirection: sortDirection
})]
})
});
}
HeaderIcon.displayName = 'VirtualizedList(HeaderIcon)';
HeaderIcon.propTypes = {
sortBy: PropTypes.string,
dataKey: PropTypes.string,
sortDirection: PropTypes.string,
label: PropTypes.string,
columnData: PropTypes.shape({
iconName: PropTypes.string
}).isRequired
};
export default HeaderIcon;
//# sourceMappingURL=HeaderIcon.component.js.map