mirror of
https://github.com/apache/superset.git
synced 2026-04-22 09:35:23 +00:00
[explore-v2] add fave star and edit button to chart header (#1623)
* add fave star to chart title * add TooltipWrapper, and css for icons * fix linting
This commit is contained in:
28
superset/assets/javascripts/components/TooltipWrapper.jsx
Normal file
28
superset/assets/javascripts/components/TooltipWrapper.jsx
Normal file
@@ -0,0 +1,28 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Tooltip, OverlayTrigger } from 'react-bootstrap';
|
||||
import { slugify } from '../modules/utils';
|
||||
|
||||
const propTypes = {
|
||||
label: PropTypes.string.isRequired,
|
||||
tooltip: PropTypes.string.isRequired,
|
||||
children: PropTypes.node.isRequired,
|
||||
placement: PropTypes.string,
|
||||
};
|
||||
|
||||
const defaultProps = {
|
||||
placement: 'top',
|
||||
};
|
||||
|
||||
export default function TooltipWrapper({ label, tooltip, children, placement }) {
|
||||
return (
|
||||
<OverlayTrigger
|
||||
placement={placement}
|
||||
overlay={<Tooltip id={`${slugify(label)}-tooltip`}>{tooltip}</Tooltip>}
|
||||
>
|
||||
{children}
|
||||
</OverlayTrigger>
|
||||
);
|
||||
}
|
||||
|
||||
TooltipWrapper.propTypes = propTypes;
|
||||
TooltipWrapper.defaultProps = defaultProps;
|
||||
Reference in New Issue
Block a user