diff --git a/packages/web/src/scss/components/Tooltip/dismissible-tooltip.mjs b/packages/web/src/scss/components/Tooltip/dismissible-tooltip.mjs new file mode 100644 index 0000000000..e1712854c4 --- /dev/null +++ b/packages/web/src/scss/components/Tooltip/dismissible-tooltip.mjs @@ -0,0 +1,16 @@ +import Tooltip from '../../../js/Tooltip.ts'; + +const myTooltipEl = document.getElementById('my-dismissible-tooltip2'); +const myTooltip = new Tooltip(myTooltipEl); + +// Remove 'my-tooltip' key from localStorage to show tooltip again. +// localStorage.removeItem('my-tooltip'); + +if (!window.localStorage.getItem('my-tooltip')) { + myTooltip.show(); +} + +document.getElementById('my-dismissible-tooltip2-button').addEventListener('click', () => { + myTooltip.hide(); + window.localStorage.setItem('my-tooltip', true); +}); diff --git a/packages/web/src/scss/components/Tooltip/index.html b/packages/web/src/scss/components/Tooltip/index.html index 91dcf78014..67ab52b973 100644 --- a/packages/web/src/scss/components/Tooltip/index.html +++ b/packages/web/src/scss/components/Tooltip/index.html @@ -78,7 +78,7 @@