Skip to content

Commit dbc7da2

Browse files
authored
fix(KERN): fix links on the PageHeader and Footer (#3165)
1 parent 8d4158b commit dbc7da2

File tree

10 files changed

+265
-200
lines changed

10 files changed

+265
-200
lines changed

app/components/kern/KernStandaloneLink.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mustachePlaceholderRegex } from "~/services/security/mustachePlaceholder";
22
import { isExternalUrl, isFileDownloadUrl } from "~/util/url";
3-
import { OpenInNewTabIcon } from "~/components/common/OpenInNewTabIcon";
43
import classNames from "classnames";
4+
import { KernIcon } from "./common/KernIcon";
55

66
type KernStandaloneLinkProps = Readonly<{
77
url: string;
@@ -43,7 +43,7 @@ export const KernStandaloneLink = ({
4343
<a {...anchorProps} className={className} data-testid={dataTestid}>
4444
{icon}
4545
{text}
46-
{shouldOpenNewTab && <OpenInNewTabIcon />}
46+
{shouldOpenNewTab && <KernIcon name="open-in-new" />}
4747
</a>
4848
);
4949
};

app/components/kern/layout/KernFooter.tsx

Lines changed: 0 additions & 127 deletions
This file was deleted.

app/components/kern/layout/KernPageHeader.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function KernPageHeader({
5454
>
5555
<a
5656
href="/"
57-
className="kern-title"
57+
className="kern-link"
5858
aria-label={`${title} - ${linkLabel}`}
5959
>
6060
{title}
@@ -65,15 +65,15 @@ export default function KernPageHeader({
6565
href={"/leichtesprache"}
6666
className="kern-link kern-link--small"
6767
>
68-
<KernIcon name="local-library" />
68+
<KernIcon name="local-library" className="flex-shrink-0" />
6969
{translations.pageHeader.leichtesprache.de}
7070
</a>
7171

7272
<a
7373
href={"/gebaerdensprache"}
7474
className="kern-link kern-link--small"
7575
>
76-
<KernIcon name="sign-language" />
76+
<KernIcon name="sign-language" className="flex-shrink-0" />
7777
{"Gebärdensprache"}{" "}
7878
{/*translations.pageHeader.gebaerdensprache.de */}
7979
</a>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import Image, { type ImageProps } from "~/components/common/Image";
2+
import { GridItem } from "~/components/layout/grid/GridItem";
3+
import { Grid } from "~/components/layout/grid/Grid";
4+
import { KernFooterExternalLinks } from "./KernFooterExternalLinks";
5+
import { KernFooterDeletePersonalData } from "./KernFooterDeletePersonalData";
6+
import { KernFooterInternalLinks } from "./KernFooterInternalLinks";
7+
8+
type FooterProps = Readonly<{
9+
image?: ImageProps;
10+
showDeletionBanner?: boolean;
11+
ariaLabel?: string;
12+
}>;
13+
14+
export default function KernFooter({
15+
image,
16+
showDeletionBanner = false,
17+
ariaLabel,
18+
}: FooterProps) {
19+
return (
20+
<>
21+
<Grid className="py-40 px-0 print:pb-0">
22+
<GridItem
23+
mdColumn={{ start: 1, span: 8 }}
24+
lgColumn={{ start: 1, span: 3 }}
25+
xlColumn={{ start: 1, span: 3 }}
26+
className="flex flex-col gap-kern-space-large"
27+
>
28+
{image && (
29+
<div className="forced-colors:bg-black">
30+
<Image {...image} />
31+
</div>
32+
)}
33+
<KernFooterExternalLinks />
34+
</GridItem>
35+
<GridItem
36+
mdColumn={{ start: 1, span: 8 }}
37+
lgColumn={{ start: 4, span: 9 }}
38+
xlColumn={{ start: 4, span: 9 }}
39+
className="[grid-row:2] md:[grid-row:2] lg:[grid-row:1] xl:[grid-row:1]"
40+
aria-label={ariaLabel}
41+
>
42+
<KernFooterInternalLinks />
43+
</GridItem>
44+
</Grid>
45+
{showDeletionBanner && <KernFooterDeletePersonalData />}
46+
</>
47+
);
48+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Grid } from "~/components/layout/grid/Grid";
2+
import { GridItem } from "~/components/layout/grid/GridItem";
3+
import { GridSection } from "~/components/layout/grid/GridSection";
4+
import { translations } from "~/services/translations/translations";
5+
import { footerContent } from "./footerContent";
6+
7+
export const KernFooterDeletePersonalData = () => {
8+
const personalDataDeleteLink = footerContent.find((section) =>
9+
section.type.includes("deletionBanner"),
10+
)?.content[0];
11+
12+
return (
13+
<GridSection className="bg-kern-neutral-025">
14+
<Grid>
15+
<GridItem
16+
mdColumn={{ start: 1, span: 8 }}
17+
lgColumn={{ start: 3, span: 8 }}
18+
xlColumn={{ start: 2, span: 10 }}
19+
className="text-white print:hidden text-center pt-16 pb-16"
20+
>
21+
<div className="text-center print:hidden">
22+
<a className="kern-link" href={personalDataDeleteLink?.url}>
23+
{translations["delete-data"].footerLinkLabel.de ??
24+
personalDataDeleteLink?.text}
25+
</a>
26+
</div>
27+
</GridItem>
28+
</Grid>
29+
</GridSection>
30+
);
31+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { KernIcon } from "../../common/KernIcon";
2+
import { footerContent } from "./footerContent";
3+
4+
export const KernFooterExternalLinks = () => {
5+
const externalLinksSections = footerContent.filter((section) =>
6+
section.type.includes("externalLink"),
7+
);
8+
return (
9+
<div>
10+
{externalLinksSections.map((section) => {
11+
const link = section.content[0];
12+
return (
13+
<p key={section.key} className="kern-body gap-kern-space-default">
14+
{section.title}{" "}
15+
<a
16+
href={link.url}
17+
className="kern-link inline-flex items-center gap-1"
18+
target="_blank"
19+
rel="noopener noreferrer"
20+
>
21+
<KernIcon
22+
name="open-in-new"
23+
className="w-[1em] h-[1em] flex-shrink-0 mt-4"
24+
/>
25+
{link.text}
26+
</a>
27+
</p>
28+
);
29+
})}
30+
</div>
31+
);
32+
};
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { footerContent } from "./footerContent";
2+
3+
export type KernFooterInternalLinksProps = {
4+
ariaLabel?: string;
5+
};
6+
7+
export const KernFooterInternalLinks = ({
8+
ariaLabel,
9+
}: KernFooterInternalLinksProps) => {
10+
const internalLinksSections = footerContent.filter((section) =>
11+
section.type.includes("internalLink"),
12+
);
13+
14+
return (
15+
<nav
16+
className="flex flex-col sm:flex-row justify-between print:hidden"
17+
aria-label={ariaLabel}
18+
>
19+
{internalLinksSections.map((section) => {
20+
const ariaLabelledBy = `footer-list-${section.key}`;
21+
return (
22+
<div
23+
key={section.key}
24+
className="flex flex-col gap-kern-space-small py-kern-space-large"
25+
>
26+
<h2 className="kern-body--bold">{section.sectionName}</h2>
27+
<ul
28+
aria-labelledby={ariaLabelledBy}
29+
className="list-none! flex flex-col gap-kern-space-small"
30+
>
31+
{section.content.map((link) => {
32+
return (
33+
<li key={link.url}>
34+
<a href={link.url} className="kern-link">
35+
{link.text ?? ""}
36+
</a>
37+
</li>
38+
);
39+
})}
40+
</ul>
41+
</div>
42+
);
43+
})}
44+
</nav>
45+
);
46+
};

0 commit comments

Comments
 (0)