@wildberries/notifications
Advanced tools
Comparing version 1.0.11-beta.1 to 1.0.11
{ | ||
"name": "@wildberries/notifications", | ||
"version": "1.0.11-beta.1", | ||
"version": "1.0.11", | ||
"description": "notifications module", | ||
@@ -40,11 +40,11 @@ "main": "dist/index.js", | ||
"@commitlint/cli": "9.1.2", | ||
"@storybook/addon-actions": "6.0.26", | ||
"@storybook/addon-console": "1.2.2", | ||
"@storybook/addon-docs": "6.0.26", | ||
"@storybook/addon-essentials": "6.0.26", | ||
"@storybook/addon-knobs": "6.0.26", | ||
"@storybook/addon-links": "6.0.26", | ||
"@storybook/addon-actions": "6.1.21", | ||
"@storybook/addon-console": "1.2.3", | ||
"@storybook/addon-docs": "6.1.21", | ||
"@storybook/addon-essentials": "6.1.21", | ||
"@storybook/addon-knobs": "6.1.21", | ||
"@storybook/addon-links": "6.1.21", | ||
"@types/uniqid": "5.2.0", | ||
"@storybook/addon-viewport": "6.0.26", | ||
"@storybook/react": "6.0.26", | ||
"@storybook/addon-viewport": "6.1.21", | ||
"@storybook/react": "6.1.21", | ||
"@types/classnames": "2.2.10", | ||
@@ -89,2 +89,4 @@ "@types/jest": "24.9.1", | ||
"sass-loader": "10.0.2", | ||
"react": "16.12.0", | ||
"react-dom": "16.12.0", | ||
"style-loader": "1.2.1", | ||
@@ -102,4 +104,2 @@ "stylelint": "13.3.3", | ||
"classnames": "2.2.6", | ||
"react": "16.13.0", | ||
"react-dom": "16.13.0", | ||
"react-redux": "7.2.0", | ||
@@ -106,0 +106,0 @@ "redux": "4.0.5", |
@@ -33,32 +33,7 @@ # @wildberries/notifications | ||
import React, { memo } from "react"; | ||
import { Notifications, setModalAction } from "@wildberries/notifications"; | ||
import { createPortal } from 'react-dom'; | ||
import { uniqueId } from 'lodash-es' | ||
import { Notifications } from "@wildberries/notifications"; | ||
const portalElement = document.getElementById('portal'); | ||
// example Portal component - you will need the DIV that will be appended by notifications | ||
class Portal extends React.PureComponent{ | ||
constructor(props) { | ||
super(props); | ||
this.containerEl = document.createElement('div'); | ||
this.containerEl.id = `${props.prefix}_${uniqueId('id_')}`; | ||
portalElement.appendChild(this.containerEl); | ||
} | ||
componentWillUnmount() { | ||
this.containerEl.remove(); | ||
} | ||
render() { | ||
return createPortal(this.props.children, this.containerEl); | ||
} | ||
} | ||
const TestComponent = memo(() => ( | ||
<div className="TestComponent"> | ||
<Portal prefix="notifications"> | ||
<Notifications /> | ||
</Portal> | ||
</div> | ||
@@ -65,0 +40,0 @@ ); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7
0
67749
61
77