Skip to content

Commit 08289a8

Browse files
authored
Merge pull request #530 from Rogger794/refactoring
Using rollup for building the project, and modifying example
2 parents d1d009c + d9132a2 commit 08289a8

13 files changed

+10217
-762
lines changed

.babelrc

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
2-
"presets": ["es2015", "react", "stage-0"],
3-
"plugins": ["transform-decorators-legacy"],
2+
"plugins": [["@babel/plugin-proposal-decorators", { "legacy": true }],
3+
"@babel/plugin-proposal-class-properties"
4+
],
5+
"presets": [
6+
["@babel/preset-env", {
7+
"modules": false
8+
}],
9+
"@babel/preset-react"
10+
]
411
}

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ cache:
33
directories:
44
- node_modules
55
node_js:
6-
- "8"
6+
- 12
77
notifications:
88
email:
99
recipients:
1010
1111
on_success: change
1212
on_failure: always
1313
install:
14-
- npm install
14+
- yarn
1515

1616
script:
17-
- npm run build
17+
- yarn build
1818
- git config --global user.name "Travis CI"
1919
- git config --global user.email "[email protected]"
2020
- export GIT_PUBLISH_URL=https://${GH_TOKEN}@github.com/wwayne/react-tooltip.git
21-
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run gh-pages -- --repo ${GIT_PUBLISH_URL}; fi
21+
- if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then yarn gh-pages -- --repo ${GIT_PUBLISH_URL}; fi
2222

2323
after_success:
24-
- npm run semantic-release
24+
- yarn semantic-release
2525

2626
branches:
2727
except:

example/index.html

-12
This file was deleted.

example/package.json

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "react-tooltip-example",
3+
"homepage": "https://github.com/wwayne/react-tooltip",
4+
"version": "1.0.0",
5+
"license": "MIT",
6+
"dependencies": {
7+
"gh-pages": "^2.1.1",
8+
"react": "^16.4.1",
9+
"react-dom": "^16.4.1",
10+
"react-scripts": "^1.1.4",
11+
"react-tooltip": "link:.."
12+
},
13+
"scripts": {
14+
"start": "react-scripts start",
15+
"build": "react-scripts build",
16+
"test": "react-scripts test --env=jsdom",
17+
"eject": "react-scripts eject",
18+
"predeploy": "npm run build",
19+
"deploy": "gh-pages -d build"
20+
}
21+
}

example/public/index.html

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<meta name="theme-color" content="#000000">
7+
8+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
9+
10+
<title>react-tooltip</title>
11+
</head>
12+
13+
<body>
14+
<noscript>
15+
You need to enable JavaScript to run this app.
16+
</noscript>
17+
18+
<div id="root"></div>
19+
</body>
20+
</html>

example/public/manifest.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"short_name": "react-tooltip",
3+
"name": "react-tooltip",
4+
"start_url": "./index.html",
5+
"display": "standalone",
6+
"theme_color": "#000000",
7+
"background_color": "#ffffff"
8+
}

example/src/index.css

+228
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
html, body {
2+
margin: 0px;
3+
padding: 0px;
4+
min-width: 1024px;
5+
}
6+
.tooltip-example {
7+
background: #1182dd;
8+
height: 550px;
9+
position: relative;
10+
}
11+
.tooltip-example .title {
12+
color: #fff;
13+
padding-top: 50px;
14+
margin-top: 0px;
15+
font-size: 45px;
16+
text-align: center;
17+
margin-bottom: 20px;
18+
font-weight: 700;
19+
}
20+
.demonstration {
21+
width: 600px;
22+
height: 150px;
23+
margin: 10px auto;
24+
background: rgba(0, 0, 0, 0.1);
25+
border-radius: 5px;
26+
box-sizing: border-box;
27+
position: relative;
28+
}
29+
.demonstration a {
30+
display: block;
31+
width: 60px;
32+
height: 60px;
33+
line-height: 60px;
34+
border-radius: 60px;
35+
text-align: center;
36+
color: #222;
37+
background: rgba(255, 255, 255, 1);
38+
position: absolute;
39+
left: 50%;
40+
top: 50%;
41+
margin-left: - 30px;
42+
margin-top: - 15px;
43+
cursor: pointer;
44+
box-shadow: 3px 4px 3px rgba(0, 0, 0, 0.5);
45+
border: 1px solid #333;
46+
}
47+
.demonstration a:after {
48+
content: "hover on me";
49+
text-align: center;
50+
color: rgba(0, 0, 0, 0.25);
51+
position: absolute;
52+
width: 100px;
53+
top: 45px;
54+
left: -18px;
55+
}
56+
.control-panel {
57+
background: rgba(255, 255, 255, 0.4);
58+
border-top: 1px solid rgba(0, 0, 0, 0.2);
59+
position: absolute;
60+
bottom: 0px;
61+
left: 0px;
62+
right: 0px;
63+
width: 100%;
64+
height: 230px;
65+
overflow: auto;
66+
}
67+
.control-panel:after {
68+
content: '';
69+
height: 0px;
70+
display: block;
71+
clear: both;
72+
}
73+
.control-panel .button-group {
74+
box-sizing: border-box;
75+
width: 55%;
76+
float: left;
77+
padding-left: 10px;
78+
}
79+
.control-panel .button-group .item {
80+
padding: 3px 2px;
81+
clear: both;
82+
}
83+
.control-panel .button-group .item p {
84+
margin: 10px 0px 2px;
85+
font-size: 18px;
86+
color: #777;
87+
}
88+
.control-panel .button-group .item a {
89+
border-radius: 3px;
90+
text-align: center;
91+
cursor: pointer;
92+
transition: background 0.25s ease-out;
93+
background: #e8e8e8;
94+
float: left;
95+
margin-right: 8px;
96+
padding: 7px 10px;
97+
font-size: 14px;
98+
}
99+
.control-panel .button-group .item a .mark {
100+
color: #888;
101+
font-size: 13px;
102+
display: inline-block;
103+
padding-left: 3px;
104+
}
105+
.control-panel .button-group .item a.active, .control-panel .button-group .item a:hover {
106+
color: #fff;
107+
background: #1182dd;
108+
}
109+
.control-panel .button-group .item a.active .mark, .control-panel .button-group .item a:hover .mark {
110+
color: rgba(255, 255, 255, 0.6);
111+
}
112+
.control-panel pre {
113+
box-sizing: border-box;
114+
width: 45%;
115+
float: left;
116+
}
117+
.control-panel pre div {
118+
background: rgba(255, 255, 255, 0.8);
119+
margin: 0px 20px;
120+
padding: 8px 12px;
121+
}
122+
.control-panel pre .label {
123+
margin: 10px 0px 2px;
124+
font-size: 18px;
125+
color: #777;
126+
}
127+
.advance .title {
128+
color: #222;
129+
padding-top: 100px;
130+
margin-top: 0px;
131+
font-size: 30px;
132+
text-align: center;
133+
margin-bottom: 20px;
134+
font-weight: 700;
135+
}
136+
.advance .sub-title {
137+
border-bottom: 1px solid rgba(0, 0, 0, 0.4);
138+
color: #666;
139+
font-size: 20px;
140+
padding-bottom: 5px;
141+
}
142+
.advance .section {
143+
width: 800px;
144+
margin: 20px auto;
145+
}
146+
.example-jsx {
147+
padding: 10px 0px;
148+
height: 50px;
149+
}
150+
.example-jsx:after {
151+
content: '';
152+
clear: both;
153+
height: 0;
154+
visibility: hidden;
155+
}
156+
.example-jsx .block {
157+
float: left;
158+
}
159+
.example-jsx .block a {
160+
text-align: center;
161+
width: 55px;
162+
height: 55px;
163+
border: 1px solid #999;
164+
border-radius: 0px;
165+
}
166+
.example-jsx .side {
167+
width: 50%;
168+
float: left;
169+
box-sizing: border-box;
170+
}
171+
.example-jsx a {
172+
text-align: center;
173+
width: 55px;
174+
height: 55px;
175+
line-height: 55px;
176+
border-radius: 55px;
177+
display: block;
178+
margin: auto;
179+
cursor: pointer;
180+
color: #999;
181+
border: 1px solid #999;
182+
font-size: 13px;
183+
}
184+
.example-jsx a:hover {
185+
color: #222;
186+
border: 1px solid #222;
187+
}
188+
.example-jsx p {
189+
margin-bottom: 2px;
190+
padding: 0px;
191+
}
192+
.example-jsx ul {
193+
padding: 0px;
194+
list-style: none;
195+
}
196+
.example-jsx ul li {
197+
padding-left: 10px;
198+
margin: 0px;
199+
text-align: left;
200+
}
201+
.example-pre {
202+
border-radius: 2px;
203+
border: 1px solid rgba(0, 0, 0, 0.2);
204+
box-sizing: border-box;
205+
padding: 10px;
206+
margin-bottom: 60px;
207+
font-size: 14px;
208+
}
209+
.example-pre p {
210+
line-height: 30px;
211+
}
212+
.extraClass {
213+
font-size: 20px !important;
214+
pointer-events: auto !important;
215+
}
216+
.extraClass:hover {
217+
visibility: visible !important;
218+
opacity: 1 !important;
219+
}
220+
.customeTheme {
221+
color: #ff6e00 !important;
222+
background-color: orange !important;
223+
}
224+
.customeTheme.place-top:after {
225+
border-top-color: orange !important;
226+
border-top-style: solid !important;
227+
border-top-width: 6px !important;
228+
}

example/src/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
'use strict'
2-
1+
import "./index.css";
32
import React from 'react'
43
import ReactDOM from 'react-dom'
5-
import ReactTooltip from '../../src'
4+
import ReactTooltip from 'react-tooltip'
65

76
class Test extends React.Component {
87
constructor(props) {
@@ -499,4 +498,4 @@ class Test extends React.Component {
499498
}
500499
}
501500

502-
ReactDOM.render(<Test />, document.getElementById('main'))
501+
ReactDOM.render(<Test />, document.getElementById('root'))

0 commit comments

Comments
 (0)