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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 (WIP) #46

Merged
merged 16 commits into from Feb 9, 2019
6 changes: 4 additions & 2 deletions .babelrc
@@ -1,6 +1,8 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react"],
"presets": ["@babel/env", "@babel/react"],
"plugins": [
"@babel/plugin-proposal-class-properties"
["@babel/transform-destructuring", { "loose": true }, "unique"],
["@babel/proposal-class-properties", { "loose": true }, "unique"],
["@babel/proposal-object-rest-spread", { "loose": true }, "unique"]
]
}
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,3 +2,5 @@ node_modules
coverage
.devserver
dist
umd
esm
9 changes: 2 additions & 7 deletions README.md
Expand Up @@ -14,16 +14,13 @@ Requires React 16.2+, `prop-types`, and `tippy.js` if using via CDN.

## Usage

Import the Tippy component and Tippy's CSS.

Required: tooltip content as `props.content` and a single element child
Required props: tooltip content as `props.content` and a single element child
(reference) as `props.children`.

```jsx
import React from 'react'
import ReactDOM from 'react-dom'
import Tippy from '@tippy.js/react'
import 'tippy.js/dist/tippy.css'

const RegularTooltip = () => (
<Tippy content="Hello">
Expand Down Expand Up @@ -87,8 +84,6 @@ Prop to control the `tippy.show()` / `tippy.hide()` instance methods. Use this
when you want to programmatically show or hide the tippy instead of relying on
UI events.

鈿狅笍 **It must be accompanied by a `"manual"` trigger prop.**

```jsx
class App extends Component {
state = {
Expand All @@ -97,7 +92,7 @@ class App extends Component {

render() {
return (
<Tippy content="test" trigger="manual" isVisible={this.state.isVisible}>
<Tippy content="test" isVisible={this.state.isVisible}>
<button />
</Tippy>
)
Expand Down
22 changes: 20 additions & 2 deletions demo/index.js
@@ -1,7 +1,6 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Tippy from '../src/Tippy'
import 'tippy.js/dist/tippy.css'
import Tippy, { TippyGroup } from '../src/Tippy'
import './index.css'

Tippy.defaultProps = {
Expand Down Expand Up @@ -147,6 +146,25 @@ class App extends React.Component {
<Tippy>
<ComponentChild />
</Tippy>

<h1>Group</h1>
<TippyGroup delay={1000}>
<Tippy>
<button>Text</button>
</Tippy>
<Tippy>
<button>Text</button>
</Tippy>
</TippyGroup>

<h1>Multiple</h1>
<Tippy placement="bottom" multiple>
<Tippy placement="left" multiple>
<Tippy>
<button>Text</button>
</Tippy>
</Tippy>
</Tippy>
</main>
)
}
Expand Down