Skip to content

Commit

Permalink
Merge pull request #204 from m2ms/#406
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskovar-m2ms authored Oct 9, 2020
2 parents afdaf0e + 09b8e7e commit 9b79504
Show file tree
Hide file tree
Showing 4 changed files with 549 additions and 466 deletions.
37 changes: 37 additions & 0 deletions js/components/common/Tooltips/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { memo } from 'react';
import PropTypes from 'prop-types';
import { Popper, Paper } from '@material-ui/core';
import SVGInline from 'react-svg-inline';

export const SvgTooltip = memo(({ open, anchorEl, imgData, width, height }) => {
return (
<Popper open={open} anchorEl={anchorEl} placement="bottom-end">
<Paper
square
style={{
height: `${height * 3}px`,
width: `${width * 3}px`
}}
>
<SVGInline
component="div"
svg={imgData}
style={{
height: `${height}px`,
width: `${width}px`,
transform: 'scale(3)',
transformOrigin: 'top left'
}}
/>
</Paper>
</Popper>
);
});

SvgTooltip.propTypes = {
open: PropTypes.bool.isRequired,
anchorEl: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]),
imgData: PropTypes.string.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired
};
1 change: 1 addition & 0 deletions js/components/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './Inputs';
export * from './Modal';
export * from './Navigation';
export * from './Surfaces';
export * from './Tooltips';
Loading

0 comments on commit 9b79504

Please sign in to comment.