From d88ba77e4cd791e314d4992f050977eff0db1069 Mon Sep 17 00:00:00 2001 From: Gjore Milevski Date: Fri, 22 Nov 2024 09:20:45 +0100 Subject: [PATCH 1/3] Add showcase for text over carousel image --- overrides/home/carousel/index.tsx | 23 +++++++++++++++++++++++ overrides/home/carousel/items.js | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/overrides/home/carousel/index.tsx b/overrides/home/carousel/index.tsx index ae691462c..348e50946 100644 --- a/overrides/home/carousel/index.tsx +++ b/overrides/home/carousel/index.tsx @@ -60,6 +60,29 @@ export function DesktopCarousel () { classNames="imagetransition" >
+ { (itemInProgress.imageOverlayText1 || itemInProgress.imageOverlayText2) && ( +
+ {itemInProgress.imageOverlayText1 && ( + {itemInProgress.imageOverlayText1} + )} + {itemInProgress.imageOverlayText2 && ( + {itemInProgress.imageOverlayText2} + )} +
+ )} {itemInProgress.imageAlt}
diff --git a/overrides/home/carousel/items.js b/overrides/home/carousel/items.js index 05e822ed1..de773723f 100644 --- a/overrides/home/carousel/items.js +++ b/overrides/home/carousel/items.js @@ -4,7 +4,9 @@ export default [ title: 'U.S. Greenhouse Gas Center', description: "The U.S. Greenhouse Gas Center (US GHG Center) is a multi-agency effort consolidating greenhouse gas information from observations and models.", image: new URL('../media/ghgc-v2.jpg', import.meta.url).href, - imageAlt: 'Earth with Greenhouse Gas Emissions shaded in red' + imageAlt: 'Earth with Greenhouse Gas Emissions shaded in red', + imageOverlayText1: 'U.S. Greenhouse Gas Center', + imageOverlayText2: 'Example second line text' }, { link: 'https://earth.gov/sealevel', From 0560f611657cbedee4014700704d24e961cbc188 Mon Sep 17 00:00:00 2001 From: Gjore Milevski Date: Fri, 22 Nov 2024 09:37:15 +0100 Subject: [PATCH 2/3] Add for tablet as well --- overrides/home/carousel/index.tsx | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/overrides/home/carousel/index.tsx b/overrides/home/carousel/index.tsx index 348e50946..ac058f41d 100644 --- a/overrides/home/carousel/index.tsx +++ b/overrides/home/carousel/index.tsx @@ -69,10 +69,8 @@ export function DesktopCarousel () { color: '#fff', background: 'rgba(0, 0, 0, 0.5)', padding: '10px', - borderRadius: '4px', fontSize: '1.2rem', fontWeight: 'bold', - lineHeight: '1.5' }} > {itemInProgress.imageOverlayText1 && ( @@ -111,7 +109,27 @@ function TabletCarousel() { {CarouselItems.map((item) => { return -
+
+ { (item.imageOverlayText1 || item.imageOverlayText2) && ( +
+ {item.imageOverlayText1 && ( + {item.imageOverlayText1} + )} + {item.imageOverlayText2 && ( + {item.imageOverlayText2} + )} +
+ )}

{item.title}

From ce7759f8b5ff54192fbe8f7be4920b57430ca4b7 Mon Sep 17 00:00:00 2001 From: Gjore Milevski Date: Fri, 22 Nov 2024 09:43:11 +0100 Subject: [PATCH 3/3] Clean up --- overrides/home/carousel/index.tsx | 77 +++++++++++++++++++------------ overrides/home/carousel/items.js | 4 +- 2 files changed, 50 insertions(+), 31 deletions(-) diff --git a/overrides/home/carousel/index.tsx b/overrides/home/carousel/index.tsx index ac058f41d..91cb16d58 100644 --- a/overrides/home/carousel/index.tsx +++ b/overrides/home/carousel/index.tsx @@ -61,26 +61,17 @@ export function DesktopCarousel () { >
{ (itemInProgress.imageOverlayText1 || itemInProgress.imageOverlayText2) && ( -
- {itemInProgress.imageOverlayText1 && ( - {itemInProgress.imageOverlayText1} - )} - {itemInProgress.imageOverlayText2 && ( - {itemInProgress.imageOverlayText2} - )} -
- )} +
+ {itemInProgress.imageOverlayText1 && } + {itemInProgress.imageOverlayText2 && } +
+ )} {itemInProgress.imageAlt}
@@ -116,18 +107,10 @@ function TabletCarousel() { style={{ bottom: '10px', left: '10px', - color: '#fff', - padding: '10px', - fontSize: '3vw', - fontWeight: 'bold', }} > - {item.imageOverlayText1 && ( - {item.imageOverlayText1} - )} - {item.imageOverlayText2 && ( - {item.imageOverlayText2} - )} + {item.imageOverlayText1 && } + {item.imageOverlayText2 && }
)} @@ -140,6 +123,40 @@ function TabletCarousel() { } +export function TitleOverImage1({ text, fontSize }) { + return ( + + {text} + + ); +} + +export function TitleOverImage2({ text, fontSize }) { + return ( + + {text} + + ); +} export default function Carousel() { const { isMediumUp } = useMediaQuery(); diff --git a/overrides/home/carousel/items.js b/overrides/home/carousel/items.js index de773723f..67233dd64 100644 --- a/overrides/home/carousel/items.js +++ b/overrides/home/carousel/items.js @@ -13,7 +13,9 @@ export default [ title: 'Global Sea Level Change Portal', description: 'The Global Sea Level Change Portal is an international collaboration that offers essential information on current and projected sea level rise to inform coastal communities across the globe.', image: new URL('../media/global_slr_v2.jpg', import.meta.url).href, - imageAlt: 'Satellite image of coastline' + imageAlt: 'Satellite image of coastline', + imageOverlayText1: 'Global Sea Level Change Portal', + imageOverlayText2: 'Example second line text' }, { link: 'https://earth.gov/sealevel/us/',