diff --git a/pages/docs/[...slug].tsx b/pages/docs/[...slug].tsx index 76b0ab500..f3e4fd17f 100644 --- a/pages/docs/[...slug].tsx +++ b/pages/docs/[...slug].tsx @@ -181,7 +181,7 @@ import getDirectoriesAndFile from "utils/get-directories-and-files"; // material tailwind html script import initHtmlScripts from "public/material-tailwind-html-v2"; -import OfferBar from "widgets/campaign/offer-bar"; +import OfferBar from "widgets/offer-bar"; const components = { h1: (props) => ( diff --git a/widgets/layout/docs-navbar.tsx b/widgets/layout/docs-navbar.tsx index c76ec3732..bdaf6f4ab 100644 --- a/widgets/layout/docs-navbar.tsx +++ b/widgets/layout/docs-navbar.tsx @@ -159,7 +159,9 @@ export function DocsNavbar({ slug, setMobileNav }: DocsNavbar) { - Black Friday + + Pricing & FAQ + diff --git a/widgets/offer-bar.tsx b/widgets/offer-bar.tsx new file mode 100644 index 000000000..d8850d694 --- /dev/null +++ b/widgets/offer-bar.tsx @@ -0,0 +1,70 @@ +import React, { useEffect, useState } from "react"; +import Link from "next/link"; +import { + Alert, + Button, + Chip, + Typography +} from "@material-tailwind/react"; + +const OFFER_STORAGE_KEY = "hideOfferBar"; + +export function OfferBar() { + + const [isVisible, setIsVisible] = useState(false); + + + useEffect(() => { + const shouldHide = localStorage.getItem(OFFER_STORAGE_KEY); + if (!shouldHide) { + setIsVisible(true); + } + + const hideUntil = Number(shouldHide); + const now = new Date().getTime(); + if (hideUntil && now > hideUntil) { + setIsVisible(true); + } + }, []); + + const handleClose = () => { + setIsVisible(false); + // add 2 days + const hideUntil = new Date().getTime() + 2 * 24 * 60 * 60 * 1000; + localStorage.setItem(OFFER_STORAGE_KEY, hideUntil.toString()); + }; + + + function Icon() { + return ( + + ); + } + + return ( + <> + {isVisible && ( + + + + + Material Tailwind Blocks, a comprehensive compilation of 170+ + blocks, now available for your use. + + + Check out + → + + handleClose()} + > + + + + + )} + > + ); +} + +export default OfferBar; \ No newline at end of file