Skip to content

Commit 7cbf905

Browse files
Fix narrow shared shells (#6048)
1 parent 295d462 commit 7cbf905

4 files changed

Lines changed: 39 additions & 2 deletions

File tree

apps/web/src/components/AuthShell.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function AuthShell({ children }: { children: ReactNode }) {
1111
const lp = useLocalePath();
1212

1313
return (
14-
<div className="mx-auto w-fit min-w-[24rem] max-w-lg px-4">
14+
<div className="mx-auto w-full max-w-lg px-4 sm:w-fit sm:min-w-[24rem]">
1515
<div className="flex min-h-screen flex-col items-center justify-center py-8">
1616
<Link href={lp("/explore")} prefetch={false} className="mb-6 block h-9 w-36">
1717
<ThemedImage
@@ -20,6 +20,8 @@ export function AuthShell({ children }: { children: ReactNode }) {
2020
alt="Job Seek"
2121
width={144}
2222
height={36}
23+
loading="eager"
24+
fetchPriority="high"
2325
/>
2426
</Link>
2527
<div className="w-full rounded-lg border border-border-soft bg-surface p-6 sm:p-8">

apps/web/src/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function Footer({ lang }: FooterProps) {
3434
</Trans>
3535
</p>
3636
<nav aria-label={i18n._(msg({ id: "common.footer.ariaLabel", comment: "Aria label for footer navigation", message: "Footer" }))} className="order-1 sm:order-2">
37-
<ul className="flex list-none gap-4 p-0">
37+
<ul className="flex flex-wrap list-none gap-x-4 gap-y-2 p-0">
3838
<li>
3939
<a className={linkClass} href={links.github.href} target="_blank" rel="noreferrer">
4040
<Trans id="common.footer.github" comment="Footer link to GitHub repo">GitHub</Trans>

apps/web/src/components/ThemedImage.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ type ThemedImageProps = {
1414
className?: string;
1515
style?: CSSProperties;
1616
sizes?: string;
17+
loading?: "eager" | "lazy";
18+
fetchPriority?: "high" | "low" | "auto";
1719
};
1820

1921
/**
@@ -41,6 +43,8 @@ export function ThemedImage({
4143
className,
4244
style,
4345
sizes,
46+
loading,
47+
fetchPriority,
4448
}: ThemedImageProps) {
4549
const { resolvedTheme } = useTheme();
4650
const [mounted, setMounted] = useState(false);
@@ -57,6 +61,8 @@ export function ThemedImage({
5761
className={className}
5862
style={style}
5963
sizes={sizes}
64+
loading={loading}
65+
fetchPriority={fetchPriority}
6066
/>
6167
);
6268
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { describe, expect, it } from "vitest";
2+
import { readFileSync } from "node:fs";
3+
4+
describe("responsive shared shells", () => {
5+
it("allows the auth shell to shrink below its desktop minimum", () => {
6+
const source = readFileSync("src/components/AuthShell.tsx", "utf8");
7+
const themedImageSource = readFileSync(
8+
"src/components/ThemedImage.tsx",
9+
"utf8",
10+
);
11+
12+
expect(source).toContain("w-full max-w-lg px-4");
13+
expect(source).toContain("sm:w-fit sm:min-w-[24rem]");
14+
expect(source).toContain('loading="eager"');
15+
expect(source).toContain('fetchPriority="high"');
16+
expect(themedImageSource).toContain("loading={loading}");
17+
expect(themedImageSource).toContain("fetchPriority={fetchPriority}");
18+
expect(source).not.toContain("w-fit min-w-[24rem] max-w-lg");
19+
});
20+
21+
it("wraps public footer links on narrow viewports", () => {
22+
const source = readFileSync("src/components/Footer.tsx", "utf8");
23+
24+
expect(source).toContain(
25+
"flex flex-wrap list-none gap-x-4 gap-y-2 p-0",
26+
);
27+
expect(source).not.toContain('className="flex list-none gap-4 p-0"');
28+
});
29+
});

0 commit comments

Comments
 (0)