diff --git a/package-lock.json b/package-lock.json index d6d7aa65..df663bbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "react-dom": "^16.2.0", "react-sortable-hoc": "^0.6.8", "select-dom": "^7.1.1", + "tailwind-merge": "^2.2.1", "webext-options-sync": "^4.2.1", "webextension-polyfill": "^0.10.0" }, @@ -80,12 +81,14 @@ "license": "MIT" }, "node_modules/@babel/runtime": { - "version": "7.8.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.8.7.tgz", - "integrity": "sha512-+AATMUFppJDw6aiR5NVPHqIQBlV/Pj8wY/EZH+lmvRdUo9xBaz/rF3alAwFJQavvKfeOlPE7oaaDHVbcySbCsg==", - "license": "MIT", + "version": "7.23.8", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.8.tgz", + "integrity": "sha512-Y7KbAP984rn1VGMbGqKmBLio9V7y5Je9GvU4rQPCPinCyNfUcToxIXl06d59URp/F3LwinvODxab5N/G6qggkw==", "dependencies": { - "regenerator-runtime": "^0.13.4" + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" } }, "node_modules/@babel/runtime-corejs3": { @@ -99,6 +102,11 @@ "regenerator-runtime": "^0.13.4" } }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, "node_modules/@biomejs/biome": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-1.5.2.tgz", @@ -13120,6 +13128,7 @@ "version": "0.13.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", + "dev": true, "license": "MIT" }, "node_modules/regex-not": { @@ -14778,6 +14787,18 @@ "node": ">=0.10.0" } }, + "node_modules/tailwind-merge": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-2.2.1.tgz", + "integrity": "sha512-o+2GTLkthfa5YUt4JxPfzMIpQzZ3adD1vLVkvKE1Twl9UAhGsEbIZhHHZVRttyW177S8PDJI3bTQNaebyofK3Q==", + "dependencies": { + "@babel/runtime": "^7.23.7" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/dcastil" + } + }, "node_modules/tailwindcss": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.1.tgz", diff --git a/package.json b/package.json index 526a155e..6697e053 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "react-dom": "^16.2.0", "react-sortable-hoc": "^0.6.8", "select-dom": "^7.1.1", + "tailwind-merge": "^2.2.1", "webext-options-sync": "^4.2.1", "webextension-polyfill": "^0.10.0" }, diff --git a/src/content/features/notifications.js b/src/content/features/notifications.js new file mode 100644 index 00000000..f6c27506 --- /dev/null +++ b/src/content/features/notifications.js @@ -0,0 +1,163 @@ +import React from 'dom-chef' +import { twMerge } from 'tailwind-merge' +import storage from '../../shared/storage' +import styles from 'tailwindInline:../styles.css' + +function createNotification({ + title, + description, + link, + linkLabel = 'Find out more', + onClose, +}) { + const rootElement = document.createElement('div') + rootElement.attachShadow({ mode: 'open' }) + + const styleElement = document.createElement('style') + styleElement.textContent = styles + + rootElement.shadowRoot.appendChild(styleElement) + + const buttonLinkClassNames = + 'inline-flex items-center justify-center gap-1 rounded-md px-2 py-1 outline-none border border-transparent transition text-center cursor-pointer text-neutral-900 bg-white hover:text-white hover:bg-neutral-950 hover:border-neutral-600 flex-1' + + rootElement.shadowRoot.appendChild( +