Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add innerStyle prop #190

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ Online examples: <https://react-component.github.io/tooltip/examples/>
<td></td>
<td>additional style of overlay node</td>
</tr>
<tr>
<td>innerStyle</td>
<td>Object</td>
<td></td>
<td>additional style of inner node</td>
</tr>
<tr>
<td>prefixCls</td>
<td>String</td>
Expand Down
5 changes: 3 additions & 2 deletions src/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default class Content extends React.Component {
]).isRequired,
id: PropTypes.string,
trigger: PropTypes.any,
innerStyle: PropTypes.object,
}

componentDidUpdate() {
Expand All @@ -20,9 +21,9 @@ export default class Content extends React.Component {
}

render() {
const { overlay, prefixCls, id } = this.props;
const { overlay, prefixCls, id, innerStyle } = this.props;
return (
<div className={`${prefixCls}-inner`} id={id} role="tooltip">
<div className={`${prefixCls}-inner`} id={id} role="tooltip" style={innerStyle || {}}>
{typeof overlay === 'function' ? overlay() : overlay}
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion src/Tooltip.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class Tooltip extends Component {
PropTypes.func,
]).isRequired,
overlayStyle: PropTypes.object,
innerStyle: PropTypes.object,
overlayClassName: PropTypes.string,
prefixCls: PropTypes.string,
mouseEnterDelay: PropTypes.number,
Expand All @@ -46,7 +47,7 @@ class Tooltip extends Component {
};

getPopupElement = () => {
const { arrowContent, overlay, prefixCls, id } = this.props;
const { arrowContent, overlay, prefixCls, id, innerStyle } = this.props;
return ([
<div className={`${prefixCls}-arrow`} key="arrow">
{arrowContent}
Expand All @@ -57,6 +58,7 @@ class Tooltip extends Component {
prefixCls={prefixCls}
id={id}
overlay={overlay}
innerStyle={innerStyle}
/>,
]);
}
Expand Down