Skip to content

Commit 97f8b67

Browse files
committed
SWSWEB-37 | add background image section and test images
1 parent c1ffbf9 commit 97f8b67

File tree

7 files changed

+1029
-3
lines changed

7 files changed

+1029
-3
lines changed

.yarn/releases/yarn-stable-temp.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

app/page.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,38 @@
1+
import { H1, H2 } from "@components/elements/headers";
2+
import { Text } from "@components/elements/text";
13
import GlobalPage from "@components/layouts/global-page";
4+
import { BgImageWrapper } from "@components/paragraphs/bg-image-section";
5+
import TwoColumn from "@components/paragraphs/rows/two-column";
6+
import Image from "next/image";
27

38
export default function Home() {
49
return (
510
<GlobalPage>
6-
11+
<H1 className="sr-only">Stanford Web Services Home</H1>
12+
<div className="w-full cc xl:p-0 xl:mx-auto xl:max-w-[1000px] rs-mt-6 rs-mb-7">
13+
<Text size={4} font="serif">Vestibulum massa nibh, fermentum ut orci iaculis, placerat viverra augue. In mauris sapien, vulputate non eros ac, malesuada.</Text>
14+
</div>
15+
<BgImageWrapper src="/images/stanford_dish.jpg" hasBgImage bgColor="bg-black">
16+
<TwoColumn column_widths="33-67" left={(
17+
<div className="text-white">
18+
<Text variant="card" className="rs-mb-8">Lasting Partnerships</Text>
19+
<H2 className="font-serif font-normal type-3">Momentum</H2>
20+
<Text>
21+
Mauris vel nunc rutrum, semper neque a, venenatis metus. Nulla egestas, enim ut blandit pulvinar, lorem tellus pulvinar ex, a eleifend ante arcu et nulla. Fusce et cursus libero. Nullam vitae lacus quis augue semper luctus nec non ex. 
22+
</Text>
23+
</div>)} right={(
24+
<div>
25+
<Image
26+
className="object-cover"
27+
src="/images/stanford_momentum.png"
28+
alt="Screenshot of the Stanford Momentum website"
29+
height={738}
30+
width={768}
31+
/>
32+
</div>
33+
)}
34+
/>
35+
</BgImageWrapper>
736
</GlobalPage>
837
);
938
}

public/images/stanford_dish.jpg

68.9 KB
Loading
529 KB
Loading
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { HTMLAttributes } from "react";
2+
import Image from "next/image";
3+
import { clsx } from "clsx";
4+
5+
type BgImageWrapperProps = HTMLAttributes<HTMLDivElement> & {
6+
bgColor?: string;
7+
hasBgImage?: boolean;
8+
src?: string;
9+
alt?: string;
10+
};
11+
12+
export const BgImageWrapper = ({
13+
className,
14+
children,
15+
bgColor,
16+
hasBgImage = false,
17+
src,
18+
alt,
19+
...props
20+
}: BgImageWrapperProps) => {
21+
return (
22+
<div
23+
{...props}
24+
className={clsx("relative rs-mb-5 w-full", bgColor, className)}
25+
>
26+
<div className="cc rs-pb-7 rs-pt-6">
27+
{hasBgImage && src && (
28+
<div className="size-full absolute top-0 left-0 z-0">
29+
<Image
30+
className="ed11y-ignore object-cover z-0"
31+
src={src}
32+
alt={alt || ""}
33+
loading={"lazy"}
34+
fill
35+
sizes="100vw"
36+
/>
37+
<div
38+
className={clsx(
39+
"absolute size-full opacity-80 z-10 backdrop-blur-sm",
40+
bgColor,
41+
)}
42+
/>
43+
</div>
44+
)}
45+
<div
46+
className="relative z-50 w-full"
47+
>
48+
{children}
49+
</div>
50+
</div>
51+
</div>
52+
);
53+
};

src/components/paragraphs/rows/two-column.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const TwoColumn = ({
2626
return (
2727
<div
2828
className={twMerge(
29-
"mb-32",
29+
"mb-32 @container",
3030
clsx({
3131
gutters: !bg_color,
3232
"px-5 pb-20 pt-20": !!bg_color,
@@ -46,8 +46,9 @@ const TwoColumn = ({
4646
>
4747
<div
4848
className={twMerge(
49-
"centered grid gap-10 @6xl:grid-cols-2 @6xl:gap-20",
49+
"centered grid gap-10 @6xl:gap-20",
5050
clsx({
51+
"@6xl:grid-cols-2": !column_widths,
5152
"@6xl:grid-cols-1-2": column_widths === "33-67",
5253
"@6xl:grid-cols-2-1": column_widths === "67-33",
5354
}),

0 commit comments

Comments
 (0)