Skip to content

Commit bb6fe48

Browse files
committed
fix: using sass styles with rollup
1 parent 30be6f6 commit bb6fe48

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/index.js

+18-17
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import { parseAria } from "./utils/aria";
1717
import nodeListToArray from "./utils/nodeListToArray";
1818

1919
/* CSS */
20-
import cssStyle from "./style";
20+
// import cssStyle from "./style";
21+
import "./index.scss";
2122

2223
@staticMethods
2324
@windowListener
@@ -132,7 +133,7 @@ class ReactTooltip extends React.Component {
132133
componentDidMount() {
133134
const { insecure, resizeHide } = this.props;
134135
if (insecure) {
135-
this.setStyleHeader(); // Set the style to the <link>
136+
// this.setStyleHeader(); // Set the style to the <link>
136137
}
137138

138139
this.bindListener(); // Bind listener for tooltip
@@ -629,20 +630,20 @@ class ReactTooltip extends React.Component {
629630
* Set style tag in header
630631
* in this way we can insert default css
631632
*/
632-
setStyleHeader() {
633+
/* setStyleHeader() {
633634
const head = document.getElementsByTagName("head")[0];
634635
if (!head.querySelector('style[id="react-tooltip"]')) {
635636
const tag = document.createElement("style");
636637
tag.id = "react-tooltip";
637-
tag.innerHTML = cssStyle;
638-
/* eslint-disable */
639-
if (typeof __webpack_nonce__ !== 'undefined' && __webpack_nonce__) {
638+
tag.innerHTML = cssStyle; */
639+
/* eslint-disable */
640+
/* if (typeof __webpack_nonce__ !== 'undefined' && __webpack_nonce__) {
640641
tag.setAttribute('nonce', __webpack_nonce__)
641-
}
642+
}*/
642643
/* eslint-enable */
643-
head.insertBefore(tag, head.firstChild);
644+
/* head.insertBefore(tag, head.firstChild);
644645
}
645-
}
646+
} */
646647

647648
/**
648649
* CLear all kinds of timeout of interval
@@ -658,13 +659,14 @@ class ReactTooltip extends React.Component {
658659
const { extraClass, html, ariaProps, disable } = this.state;
659660
const placeholder = this.getTooltipContent();
660661
const isEmptyTip = this.isEmptyTip(placeholder);
661-
const tooltipClass ="__react_component_tooltip" +
662-
(( this.state.show && !disable && !isEmptyTip)? " show": "")+
663-
( this.state.border?" border":"" )+
664-
` place-${this.state.place}`+ // top, bottom, left, right
665-
` type-${this.state.type}`+ // dark, success, warning, error, info, light
666-
( this.props.delayUpdate?" allow_hover":"" )+
667-
( this.props.clickable?" allow_click":"" )
662+
const tooltipClass =
663+
"__react_component_tooltip" +
664+
(this.state.show && !disable && !isEmptyTip ? " show" : "") +
665+
(this.state.border ? " border" : "") +
666+
` place-${this.state.place}` + // top, bottom, left, right
667+
` type-${this.state.type}` + // dark, success, warning, error, info, light
668+
(this.props.delayUpdate ? " allow_hover" : "") +
669+
(this.props.clickable ? " allow_click" : "");
668670

669671
let Wrapper = this.props.wrapper;
670672
if (ReactTooltip.supportedWrappers.indexOf(Wrapper) < 0) {
@@ -701,5 +703,4 @@ class ReactTooltip extends React.Component {
701703
}
702704
}
703705

704-
/* export default not fit for standalone, it will exports {default:...} */
705706
export default ReactTooltip;

0 commit comments

Comments
 (0)