diff --git a/packages/fakeyou.com/src/components/common/Alert/Alert.scss b/packages/fakeyou.com/src/components/common/Alert/Alert.scss new file mode 100644 index 0000000000..315c3dd026 --- /dev/null +++ b/packages/fakeyou.com/src/components/common/Alert/Alert.scss @@ -0,0 +1,23 @@ +.alert { + border-radius: 0.5rem !important; + font-weight: 400; + font-size: 14px; + margin-bottom: 1rem !important; + padding: 0.75rem 0.75rem !important; + + &.alert-dismissible { + padding-right: 2rem !important; + } + + .btn-close { + padding: 1rem 1rem !important; + transition: 0.2s; + font-size: 11px; + } +} + +.alert-new { + background-color: #fff3d0; + color: #833c00; + border-color: #833c00; +} diff --git a/packages/fakeyou.com/src/components/common/Alert/Alert.tsx b/packages/fakeyou.com/src/components/common/Alert/Alert.tsx new file mode 100644 index 0000000000..074f6f1cae --- /dev/null +++ b/packages/fakeyou.com/src/components/common/Alert/Alert.tsx @@ -0,0 +1,89 @@ +import { IconProp } from "@fortawesome/fontawesome-svg-core"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import React, { useState } from "react"; +import "./Alert.scss"; +import { faArrowRight } from "@fortawesome/pro-solid-svg-icons"; +import { Link } from "react-router-dom"; + +interface AlertProps { + id: string; + message: string; + alertVariant?: + | "primary" + | "secondary" + | "success" + | "danger" + | "warning" + | "info" + | "light" + | "dark" + | "new"; + duration?: number; + icon?: IconProp; + link?: string; + linkText?: string; +} + +function Alert({ + id, + message, + alertVariant, + duration, + icon, + linkText, + link, +}: AlertProps) { + const [show, setShow] = useState(() => { + const closedAt = localStorage.getItem(`alertClosedAt_${id}`); + const currentTime = Date.now(); + const hideDurationPassed = + !closedAt || currentTime - parseInt(closedAt) >= duration! * 1000; // Using ! after duration since it can be undefined, but defaultProps will handle it + + if (hideDurationPassed) { + localStorage.removeItem(`alertClosedAt_${id}`); + } + + return hideDurationPassed; + }); + + const handleClose = () => { + setShow(false); + localStorage.setItem(`alertClosedAt_${id}`, Date.now().toString()); + }; + + return ( + <> + {show && ( +
+ {icon && } + {message}{" "} + {link && linkText && ( + +
+ {linkText} + +
+ + )} + +
+ )} + + ); +} + +Alert.defaultProps = { + alertVariant: "primary", + duration: 259200, // default to 3 days in seconds +}; + +export default Alert; diff --git a/packages/fakeyou.com/src/scss/site-refresh.scss b/packages/fakeyou.com/src/scss/site-refresh.scss index 409986a865..c5c5db3e5f 100644 --- a/packages/fakeyou.com/src/scss/site-refresh.scss +++ b/packages/fakeyou.com/src/scss/site-refresh.scss @@ -404,26 +404,6 @@ styles with important tags: } } - .alert { - border-radius: 0.5rem; - font-weight: 400; - font-size: 12px; - margin-bottom: 1rem; - padding: 0.75rem 1rem; - - a { - color: darken($primary, 3%); - - &:hover { - opacity: 0.85; - } - } - - &.alert-dismissible { - padding-right: 2.75rem; - } - } - .input-icon { display: flex; align-items: center; @@ -719,10 +699,6 @@ styles with important tags: } } - .btn-close { - transition: 0.2s; - } - .session-tts-section { height: 100%; overflow-x: hidden; @@ -1322,10 +1298,6 @@ styles with important tags: font-size: 14px; } - .alert-info { - font-size: 14px; - } - .range-slider-value { text-align: center; max-width: 50px; @@ -1465,10 +1437,6 @@ textarea { font-size: 18px; } - .alert { - font-size: 13px; - } - .session-tts-section { height: 450px; } @@ -1499,10 +1467,6 @@ textarea { padding-top: 7rem; padding-bottom: 7rem; } - - .alert-info { - font-size: 16px; - } } } diff --git a/packages/fakeyou.com/src/v2/view/pages/landing/LandingPage.tsx b/packages/fakeyou.com/src/v2/view/pages/landing/LandingPage.tsx index 8caf0e9113..2d57750a71 100644 --- a/packages/fakeyou.com/src/v2/view/pages/landing/LandingPage.tsx +++ b/packages/fakeyou.com/src/v2/view/pages/landing/LandingPage.tsx @@ -13,6 +13,7 @@ import { faDiscord, faTwitter } from "@fortawesome/free-brands-svg-icons"; import { WebUrl } from "../../../../common/WebUrl"; import { faFileArrowUp, faSparkles } from "@fortawesome/pro-solid-svg-icons"; import { PosthogClient } from "@storyteller/components/src/analytics/PosthogClient"; +import Alert from "components/common/Alert/Alert"; // import { // faFileArrowUp, // faMicrophone, @@ -147,17 +148,15 @@ function LandingPage(props: Props) { return (
- {/* Community Commissions Alert */} - {/*
- - - Get rewarded from our $15k prize pool for creating Voice to Voice - models! - - - See details - -
*/} + {/* Face Animation Alert Banner */} +
@@ -334,7 +333,9 @@ function LandingPage(props: Props) { >
-

{t("productVideoTitle")}

+

+ {t("productVideoTitle")} +

{t("productVideoText")}