diff --git a/client/config/webpack.config.js b/client/config/webpack.config.js index f7ef4d6f729b..b36f95683e46 100644 --- a/client/config/webpack.config.js +++ b/client/config/webpack.config.js @@ -53,9 +53,7 @@ const shouldInlineRuntimeChunk = process.env.INLINE_RUNTIME_CHUNK !== "false"; const emitErrorsAsWarnings = process.env.ESLINT_NO_DEV_ERRORS === "true"; const disableESLintPlugin = process.env.DISABLE_ESLINT_PLUGIN === "true"; -const imageInlineSizeLimit = parseInt( - process.env.IMAGE_INLINE_SIZE_LIMIT || "10000" -); +const imageInlineSizeLimit = 0; // our CSP doesn't support inline images // Check if TypeScript is setup const useTypeScript = fs.existsSync(paths.appTsConfig); diff --git a/client/src/assets/icons/user-research.png b/client/src/assets/icons/user-research.png new file mode 100644 index 000000000000..583ad64f4353 Binary files /dev/null and b/client/src/assets/icons/user-research.png differ diff --git a/client/src/document/index.tsx b/client/src/document/index.tsx index 11fa1f0166b9..b45481d94429 100644 --- a/client/src/document/index.tsx +++ b/client/src/document/index.tsx @@ -45,6 +45,7 @@ import { useIncrementFrequentlyViewed } from "../plus/collections/frequently-vie import { useInteractiveExamplesActionHandler as useInteractiveExamplesTelemetry } from "../telemetry/interactive-examples"; import { SidePlacement } from "../ui/organisms/placement"; import { BaselineIndicator } from "./baseline-indicator"; +import { UserResearchSurvey } from "../ui/molecules/user-research-survey"; // import { useUIStatus } from "../ui-context"; // Lazy sub-components @@ -257,6 +258,7 @@ export function Document(props /* TODO: define a TS interface for this */) { )}
+

{doc.title}

{doc.baseline && } diff --git a/client/src/ui/molecules/user-research-survey/index.scss b/client/src/ui/molecules/user-research-survey/index.scss new file mode 100644 index 000000000000..ec2ee1a63915 --- /dev/null +++ b/client/src/ui/molecules/user-research-survey/index.scss @@ -0,0 +1,46 @@ +.user-research-banner { + --icon-primary: #696969; + background: #e6deff; + border-radius: 0.5rem; + color: #1b1b1b; + margin-bottom: 2rem; + padding: 1rem; + padding-left: 5.5rem; + padding-right: 3rem; + position: relative; + + &::before { + background-image: url("../../../assets/icons/user-research.png"); + background-position: center center; + background-repeat: no-repeat; + background-size: contain; + content: ""; + display: block; + height: 3.5rem; + left: 1rem; + position: absolute; + width: 3.5rem; + } + + .dismiss { + position: absolute; + right: 1rem; + top: 1rem; + + button { + cursor: pointer; + } + + .icon { + margin-top: -0.25rem; + } + } + + a { + color: #6800cf !important; + + &.external::after { + display: none; + } + } +} diff --git a/client/src/ui/molecules/user-research-survey/index.tsx b/client/src/ui/molecules/user-research-survey/index.tsx new file mode 100644 index 000000000000..8ef1455de9a2 --- /dev/null +++ b/client/src/ui/molecules/user-research-survey/index.tsx @@ -0,0 +1,50 @@ +import { useEffect, useState } from "react"; +import { Doc } from "../../../../../libs/types/document"; +import { Icon } from "../../atoms/icon"; + +import "./index.scss"; + +const LOCAL_STORAGE_KEY = "user_research.2023_07.hidden"; + +export function UserResearchSurvey({ doc }: { doc: Doc }) { + const [hidden, setHidden] = useState(true); + + useEffect(() => { + if (/en-US\/docs\/Learn(\/|$)/i.test(doc.mdn_url)) { + setHidden( + Boolean(JSON.parse(localStorage.getItem(LOCAL_STORAGE_KEY) || "false")) + ); + } + }, [doc.mdn_url]); + + const dismiss = () => { + setHidden(true); + localStorage.setItem(LOCAL_STORAGE_KEY, "true"); + }; + + return hidden ? null : ( +
+ We want to hear from you! Help guide development on MDN and participate in + our{" "} + + user research survey + + . +
+ +
+
+ ); +}