Skip to content

Commit

Permalink
fix(pr): package.json fix; refactoring to exclude dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kebabmaster committed Mar 2, 2020
1 parent 9a85253 commit fdc17d4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 46 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
!.gitignore
!.npmignore

# NPM
package-lock.json

# files
node_modules/
dist/
Expand Down
8 changes: 0 additions & 8 deletions build/manifest.json

This file was deleted.

8 changes: 2 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 1 addition & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "react tooltip component",
"main": "dist/index.js",
"module": "dist/index.es.js",
"jsnext:main": "dist/index.ex.js",
"jsnext:main": "dist/index.es.js",
"engines": {
"node": ">=8",
"npm": ">=5"
Expand All @@ -30,16 +30,6 @@
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"standard": {
"parser": "babel-eslint",
"ignore": [
"dist/",
"standalone/",
"src/style.js",
"src/style.css",
"example/"
]
},
"repository": {
"type": "git",
"url": "https://github.com/wwayne/react-tooltip"
Expand All @@ -66,8 +56,6 @@
},
"dependencies": {
"aphrodite-jss": "^2.1.0",
"classnames": "^2.2.6",
"lodash": "^4.17.15",
"prop-types": "^15.7.2"
},
"devDependencies": {
Expand Down
4 changes: 1 addition & 3 deletions src/decorators/defaultStyles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import _ from "lodash";

/**
* Default pop-up style values (text color, background color).
*/
Expand All @@ -13,5 +11,5 @@ const defaultColors = {
};

export function getDefaultPopupColors (type) {
return _.cloneDeep(defaultColors[type]);
return defaultColors[type] ? { ...defaultColors[type] } : undefined;
}
21 changes: 8 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable no-unused-vars, dot-notation */
import React from "react";
import PropTypes from "prop-types";
import classname from "classnames";

/* Decorators */
import staticMethods from "./decorators/staticMethods";
Expand Down Expand Up @@ -674,18 +673,14 @@ class ReactTooltip extends React.Component {
const placeholder = this.getTooltipContent();
const isEmptyTip = this.isEmptyTip(placeholder);

const tooltipClass = classname(
"__react_component_tooltip",
{ "show": this.state.show && !disable && !isEmptyTip },
{ "border": this.state.border },
{ "place-top": this.state.place === "top" },
{ "place-bottom": this.state.place === "bottom" },
{ "place-left": this.state.place === "left" },
{ "place-right": this.state.place === "right" },
{ ["type-" + (this.hasCustomColors() ? "custom" : this.state.type)]: this.state.type },
{ "allow_hover": this.props.delayUpdate },
{ "allow_click": this.props.clickable }
);
const tooltipClass =
"__react_component_tooltip" +
(this.state.show && !disable && !isEmptyTip ? " show" : "") +
(this.state.border ? " border" : "") +
` place-${this.state.place}` + // top, bottom, left, right
` type-${(this.hasCustomColors() ? "custom" : this.state.type)}` + // dark, success, warning, error, info, light, custom
(this.props.delayUpdate ? " allow_hover" : "") +
(this.props.clickable ? " allow_click" : "");

const tooltipStyle = getTooltipStyle(getPopupColors(this.state.customColors, this.state.type, this.state.border));

Expand Down

0 comments on commit fdc17d4

Please sign in to comment.