Skip to content

Commit 86ef38a

Browse files
committed
move to babel 7
1 parent 865a6ad commit 86ef38a

File tree

7 files changed

+2894
-1412
lines changed

7 files changed

+2894
-1412
lines changed

.babelrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ render(
2626
tooltip={({ getTooltipProps, arrowProps, arrowPlacement }) => (
2727
<div className="tooltip" {...getTooltipProps()}>
2828
<div
29+
data-placement={arrowPlacement}
2930
className="arrow"
3031
{...arrowProps}
31-
data-placement={arrowPlacement}
3232
/>
3333
{tooltip}
3434
</div>
@@ -40,17 +40,13 @@ render(
4040
);
4141
```
4242

43-
`<TooltipTrigger />` is the only component exposed by the package.
44-
It doesn't render anything itself. It calls the render functions and renders that.
43+
`TooltipTrigger` is the only component exposed by the package. It's just a positioning engine. What to render is left completely to the user, which can be provided using render props.
4544

46-
Read more about [render prop](https://cdb.reacttraining.com/use-a-render-prop-50de598f11ce) pattern
47-
if you're not familiar with this approach.
45+
Read more about [render prop](https://cdb.reacttraining.com/use-a-render-prop-50de598f11ce) pattern if you're not familiar with this approach.
4846

4947
## Quick start
5048

51-
The package itself doesn't expose any styles and doesn't render anything. To start using it you
52-
have to provide styles and markup for the tooltip to be displayed. You may use default styles from
53-
`react-popper-tooltip/dist/styles.css` or add your own.
49+
If you would like our opinionated container and arrow styles for your tooltip for quick start, you may import `react-popper-tooltip/dist/styles.css`, and use the classes `tooltip-container` and `tooltip-arrow` as follows:
5450

5551
### Tooltip.js
5652

@@ -61,11 +57,11 @@ import 'react-popper-tooltip/dist/styles.css';
6157

6258
const Tooltip = ({ tooltip, children, ...props }) => (
6359
<TooltipTrigger
64-
{...props}
60+
{...props}
6561
tooltip={({ getTooltipProps, tooltipRef, arrowStyle, arrowRef, arrowPlacement }) => (
66-
<div className="tooltipContainer" ref={tooltipRef} {...getTooltipProps()}>
62+
<div className="tooltip-container" ref={tooltipRef} {...getTooltipProps()}>
6763
<div
68-
className="tooltipArrow"
64+
className="tooltip-arrow"
6965
ref={arrowRef}
7066
style={arrowStyle}
7167
data-placement={arrowPlacement}
@@ -237,5 +233,3 @@ react wrapper around [Popper.js](https://popper.js.org).
237233

238234
Using of render props, prop getters and doc style of this library are heavily inspired by
239235
[downshift](https://github.com/paypal/downshift).
240-
241-

babel.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const presets = [
2+
[
3+
'@babel/env',
4+
{
5+
useBuiltIns: 'usage'
6+
}
7+
],
8+
[
9+
'@babel/react',
10+
{
11+
useBuiltIns: true
12+
}
13+
],
14+
'minify'
15+
];
16+
17+
const plugins = ['@babel/plugin-proposal-class-properties'];
18+
19+
module.exports = { presets, plugins };

0 commit comments

Comments
 (0)