diff --git a/client/config/webpack.config.js b/client/config/webpack.config.js index 0c6e8a9460a4..96d83038f9d9 100644 --- a/client/config/webpack.config.js +++ b/client/config/webpack.config.js @@ -239,6 +239,14 @@ function config(webpackEnv) { // match the requirements. When no loader matches it will fall // back to the "file" loader at the end of the loader list. oneOf: [ + { + resourceQuery: /raw/, + type: "asset/source", + }, + { + resourceQuery: /url/, + type: "asset/resource", + }, { test: [/\.avif$/, /\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], type: "asset/resource", diff --git a/client/public/assets/curriculum/scrim.png b/client/public/assets/curriculum/scrim.png deleted file mode 100644 index 7c2748608888..000000000000 Binary files a/client/public/assets/curriculum/scrim.png and /dev/null differ diff --git a/client/src/assets/curriculum/scrim-bg.png b/client/src/assets/curriculum/scrim-bg.png new file mode 100644 index 000000000000..26929f273315 Binary files /dev/null and b/client/src/assets/curriculum/scrim-bg.png differ diff --git a/client/src/assets/curriculum/scrim-play.svg b/client/src/assets/curriculum/scrim-play.svg new file mode 100644 index 000000000000..1c58caf801bb --- /dev/null +++ b/client/src/assets/curriculum/scrim-play.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/client/src/curriculum/index.scss b/client/src/curriculum/index.scss index 575e4f03f3e1..6f1eedda36d3 100644 --- a/client/src/curriculum/index.scss +++ b/client/src/curriculum/index.scss @@ -287,6 +287,12 @@ list-style-type: disc; margin: 0.5rem 0; } + + scrim-inline { + display: block; + height: 14.25rem; + width: 22rem; + } } } } diff --git a/client/src/curriculum/landing.scss b/client/src/curriculum/landing.scss index 41d0b50f8298..dd9eda5615d0 100644 --- a/client/src/curriculum/landing.scss +++ b/client/src/curriculum/landing.scss @@ -265,15 +265,40 @@ grid-area: arrow; } - .scrim { + .scrim-wrapper { + display: flex; + flex-direction: column; grid-area: scrim; + justify-content: center; justify-self: center; margin-top: 1rem; + max-width: 24rem; @media (min-width: $screen-lg) { justify-self: end; margin-top: 0; } + + .scrim-border { + background-image: var(--curriculum-scrim-bg); + background-position: bottom right; + background-repeat: no-repeat; + height: 16rem; + width: 100%; + } + + scrim-inline { + background: #000; + display: block; + height: 14.25rem; + max-width: calc(100vw - var(--gutter) * 2); + width: 22rem; + } + + p { + margin: 0; + padding: 1rem 0; + } } } } diff --git a/client/src/curriculum/landing.tsx b/client/src/curriculum/landing.tsx index e247b2e7ed31..787ebf736a32 100644 --- a/client/src/curriculum/landing.tsx +++ b/client/src/curriculum/landing.tsx @@ -7,7 +7,7 @@ import { CurriculumDoc, CurriculumData } from "../../../libs/types/curriculum"; import { ModulesListList } from "./modules-list"; import { useCurriculumDoc } from "./utils"; import { RenderCurriculumBody } from "./body"; -import { useMemo } from "react"; +import { lazy, Suspense, useMemo } from "react"; import { DisplayH2 } from "../document/ingredients/utils"; import { CurriculumLayout } from "./layout"; @@ -15,7 +15,9 @@ import "./index.scss"; import "./landing.scss"; import { ProseSection } from "../../../libs/types/document"; import { PartnerBanner } from "./partner-banner"; -import { ScrimIframe } from "./scrim"; +import { useIsServer } from "../hooks"; + +const ScrimInline = lazy(() => import("./scrim-inline")); export function CurriculumLanding(appProps: HydrationData) { const doc = useCurriculumDoc(appProps as CurriculumData); @@ -129,13 +131,18 @@ const SCRIM_URL = "https://v2.scrimba.com/s06icdv?via=mdn"; function About({ section }) { const { title, content, id } = section.value; const html = useMemo(() => ({ __html: content }), [content]); + const isServer = useIsServer(); + return (
- +
+
+ {!isServer && } +

Learn our curriculum with high quality, interactive courses from our partner{" "} @@ -149,7 +156,7 @@ function About({ section }) { {" !"}

- +
); diff --git a/client/src/curriculum/module.tsx b/client/src/curriculum/module.tsx index deddee4a33a9..07cf874ad478 100644 --- a/client/src/curriculum/module.tsx +++ b/client/src/curriculum/module.tsx @@ -5,12 +5,18 @@ import { PrevNext } from "./prev-next"; import { RenderCurriculumBody } from "./body"; import { CurriculumLayout } from "./layout"; import { topic2css, useCurriculumDoc } from "./utils"; +import { useEffect } from "react"; import "./index.scss"; import "./module.scss"; export function CurriculumModule(props: HydrationData) { const doc = useCurriculumDoc(props as CurriculumData); + + useEffect(() => { + import("./scrim-inline"); + }, []); + return (