diff --git a/frontends/main/next.config.js b/frontends/main/next.config.js
index 6283b8c7ab..44af6220cc 100644
--- a/frontends/main/next.config.js
+++ b/frontends/main/next.config.js
@@ -44,74 +44,14 @@ const nextConfig = {
images: {
remotePatterns: [
{
- protocol: "https",
- hostname: "*.mit.edu",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "i.embed.ly",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "ol-xpro-app-production.s3.amazonaws.com",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "*.cloudfront.net",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "*.edx-cdn.org",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "i.ytimg.com",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "i1.sndcdn.com",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "*.medium.com",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "image.simplecastcdn.com",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "megaphone.imgix.net",
- port: "",
- pathname: "**",
- },
- {
- protocol: "https",
- hostname: "artwork.captivate.fm",
+ protocol: "http",
+ hostname: "**",
port: "",
pathname: "**",
},
{
protocol: "https",
- hostname: "xpro-app-rc.s3.amazonaws.com",
+ hostname: "**",
port: "",
pathname: "**",
},
diff --git a/frontends/main/src/app-pages/HomePage/HomePage.test.tsx b/frontends/main/src/app-pages/HomePage/HomePage.test.tsx
index 1617a43b47..6938d2be05 100644
--- a/frontends/main/src/app-pages/HomePage/HomePage.test.tsx
+++ b/frontends/main/src/app-pages/HomePage/HomePage.test.tsx
@@ -176,7 +176,8 @@ describe("Home Page News and Events", () => {
let section
await waitFor(() => {
section = screen
- .getByRole("heading", { name: "Stories" })!
+ .getAllByRole("heading", { name: "Stories" })!
+ .at(0)!
.closest("section")!
})
@@ -227,7 +228,8 @@ describe("Home Page News and Events", () => {
let section
await waitFor(() => {
section = screen
- .getByRole("heading", { name: "Events" })!
+ .getAllByRole("heading", { name: "Events" })!
+ .at(0)!
.closest("section")!
})
@@ -334,6 +336,8 @@ test("Headings", async () => {
{ level: 2, name: "MIT Stories & Events" },
{ level: 3, name: "Stories" },
{ level: 3, name: "Events" },
+ { level: 3, name: "Stories" },
+ { level: 3, name: "Events" },
])
})
})
diff --git a/frontends/main/src/app-pages/HomePage/NewsEventsSection.tsx b/frontends/main/src/app-pages/HomePage/NewsEventsSection.tsx
index 70838d9f4e..9c6923bd8a 100644
--- a/frontends/main/src/app-pages/HomePage/NewsEventsSection.tsx
+++ b/frontends/main/src/app-pages/HomePage/NewsEventsSection.tsx
@@ -5,7 +5,6 @@ import {
theme,
Typography,
Grid,
- useMuiBreakpointAtLeast,
Card,
TypographyProps,
} from "ol-components"
@@ -63,8 +62,8 @@ const MobileContainer = styled.section`
width: 100%;
margin: 0 -16px;
- h4 {
- margin: 0 16px 24px;
+ h3 {
+ margin: 0 16px 12px;
}
`
@@ -101,6 +100,7 @@ const Events = styled.div`
const MobileEvents = styled(Events)`
padding: 0 16px;
+ gap: 18px;
`
const EventCard = styled(Card)`
@@ -167,6 +167,24 @@ const Chevron = styled(RiArrowRightSLine)`
justify-content: flex-end;
`
+const AboveMdOnly = styled.div(({ theme }) => ({
+ [theme.breakpoints.down("md")]: {
+ display: "none",
+ },
+}))
+
+const BelowMdOnly = styled.div(({ theme }) => ({
+ [theme.breakpoints.up("md")]: {
+ display: "none",
+ },
+}))
+
+const AboveLgOnly = styled.div(({ theme }) => ({
+ [theme.breakpoints.down("lg")]: {
+ display: "none",
+ },
+}))
+
const Story: React.FC<{ item: NewsFeedItem; mobile: boolean }> = ({
item,
mobile,
@@ -199,14 +217,11 @@ const NewsEventsSection: React.FC = () => {
sortby: "event_date",
})
- const isAboveLg = useMuiBreakpointAtLeast("lg")
- const isMobile = !useMuiBreakpointAtLeast("md")
-
if (!news || !events) {
return null
}
- const stories = news!.results?.slice(0, isAboveLg || isMobile ? 6 : 4) || []
+ const stories = news!.results?.slice(0, 6) || []
const EventCards =
events!.results?.map((item) => (
@@ -241,7 +256,7 @@ const NewsEventsSection: React.FC = () => {
See what's happening in the world of learning with the latest news,
insights, and upcoming events at MIT.
- {isMobile ? (
+
@@ -251,7 +266,7 @@ const NewsEventsSection: React.FC = () => {
{stories.map((item) => (
))}
@@ -264,7 +279,8 @@ const NewsEventsSection: React.FC = () => {
{EventCards}
- ) : (
+
+
@@ -272,9 +288,15 @@ const NewsEventsSection: React.FC = () => {
Stories
- {stories.map((item) => (
+ {stories.map((item, index) => (
-
+ {index >= 4 ? (
+
+
+
+ ) : (
+
+ )}
))}
@@ -287,7 +309,7 @@ const NewsEventsSection: React.FC = () => {
- )}
+
)
}
diff --git a/frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCard.tsx b/frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCard.tsx
index 94311624cb..00d6fb243f 100644
--- a/frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCard.tsx
+++ b/frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCard.tsx
@@ -21,7 +21,6 @@ import {
import { ListCard } from "../Card/ListCard"
import { ActionButtonProps } from "../Button/Button"
import { theme } from "../ThemeProvider/ThemeProvider"
-import { useMuiBreakpointAtLeast } from "../../hooks/useBreakpoint"
const IMAGE_SIZES = {
mobile: { width: 116, height: 104 },
@@ -181,7 +180,7 @@ export const Format = ({ resource }: { resource: LearningResource }) => {
)
}
-const Loading = styled.div<{ mobile?: boolean }>`
+const Loading = styled.div`
display: flex;
padding: 24px;
justify-content: space-between;
@@ -194,40 +193,54 @@ const Loading = styled.div<{ mobile?: boolean }>`
flex-grow: 0;
margin-left: auto;
}
- ${({ mobile }) =>
- mobile
- ? `
- padding: 0px;
- > div {
- padding: 12px;
- }`
- : ""}
`
-const LoadingView = ({ isMobile }: { isMobile: boolean }) => {
- const { width, height } = IMAGE_SIZES[isMobile ? "mobile" : "desktop"]
+const MobileLoading = styled(Loading)(({ theme }) => ({
+ [theme.breakpoints.up("md")]: {
+ display: "none",
+ },
+ padding: "0px",
+ "> div": {
+ padding: "12px",
+ },
+}))
+
+const DesktopLoading = styled(Loading)(({ theme }) => ({
+ [theme.breakpoints.down("md")]: {
+ display: "none",
+ },
+}))
+
+const LoadingView = () => {
return (
-
-
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+ >
)
}
@@ -282,13 +295,11 @@ const LearningResourceListCard: React.FC = ({
inUserList,
draggable,
}) => {
- const isMobile = !useMuiBreakpointAtLeast("md")
-
if (isLoading) {
return (
-
+
)
@@ -302,7 +313,7 @@ const LearningResourceListCard: React.FC = ({
diff --git a/frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCardCondensed.tsx b/frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCardCondensed.tsx
index 72e3e9ceb0..a481225bc8 100644
--- a/frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCardCondensed.tsx
+++ b/frontends/ol-components/src/components/LearningResourceCard/LearningResourceListCardCondensed.tsx
@@ -13,7 +13,6 @@ import {
getLearningResourcePrices,
} from "ol-utilities"
import { ListCardCondensed } from "../Card/ListCardCondensed"
-import { useMuiBreakpointAtLeast } from "../../hooks/useBreakpoint"
import {
Certificate,
Price,
@@ -51,13 +50,13 @@ const Info = ({ resource }: { resource: LearningResource }) => {
)
}
-const Loading = styled.div<{ mobile?: boolean }>`
+const Loading = styled.div`
padding: 16px;
`
-const LoadingView = ({ isMobile }: { isMobile: boolean }) => {
+const LoadingView = () => {
return (
-
+
@@ -103,13 +102,11 @@ const LearningResourceListCardCondensed: React.FC<
inUserList,
draggable,
}) => {
- const isMobile = !useMuiBreakpointAtLeast("md")
-
if (isLoading) {
return (
-
+
)
diff --git a/frontends/ol-components/src/hooks/useBreakpoint.ts b/frontends/ol-components/src/hooks/useBreakpoint.ts
deleted file mode 100644
index c8288d11e6..0000000000
--- a/frontends/ol-components/src/hooks/useBreakpoint.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import useMediaQuery from "@mui/material/useMediaQuery"
-import type { Theme, Breakpoint } from "@mui/material/styles"
-
-/**
- * Returns true if the screen width is at least as wide as the given MUI
- * breakpoint width.
- */
-const useMuiBreakpointAtLeast = (breakpoint: Breakpoint): boolean => {
- return useMediaQuery((theme) => theme.breakpoints.up(breakpoint))
-}
-
-export { useMuiBreakpointAtLeast }
diff --git a/frontends/ol-components/src/index.ts b/frontends/ol-components/src/index.ts
index 6dcc13f560..0968d379f0 100644
--- a/frontends/ol-components/src/index.ts
+++ b/frontends/ol-components/src/index.ts
@@ -220,8 +220,6 @@ export type {
export { Link, linkStyles } from "./components/Link/Link"
export type { LinkProps } from "./components/Link/Link"
-export * from "./hooks/useBreakpoint"
-
export { pxToRem } from "./components/ThemeProvider/typography"
export { MITLearnGlobalStyles } from "./components/ThemeProvider/MITLearnGlobalStyles"