@talend/react-components
Version:
Set of react components.
34 lines (33 loc) • 1.04 kB
JavaScript
/* eslint-disable jsx-a11y/no-static-element-interactions */
import { useState } from 'react';
import classnames from 'classnames';
import theme from './Tile.module.scss';
import { TileContext } from './context';
/**
* We need to stop propagation when focusing an input
* in order to prevent the drag n drop feature from starting at that moment
* @param e event
*/
import { jsx as _jsx } from "react/jsx-runtime";
function ignoreDragOnInput(e) {
if (e.target.tagName.toLowerCase() === 'input') {
e.stopPropagation();
}
}
function Tile(props) {
const [displayMode, setDisplayMode] = useState('');
const contextValues = {
displayMode,
setDisplayMode
};
return /*#__PURE__*/_jsx(TileContext.Provider, {
value: contextValues,
children: /*#__PURE__*/_jsx("div", {
className: classnames(theme['tc-tile-container'], 'tc-tile-container', props.className),
onMouseDown: ignoreDragOnInput,
children: props.children
})
});
}
export default Tile;
//# sourceMappingURL=Tile.component.js.map