Skip to content

Commit

Permalink
feat(Implement Kopfzeile) (#1499)
Browse files Browse the repository at this point in the history
* add Kopfzeile component and custom Fira Sans font

* add Storybook component
  • Loading branch information
Spencer6497 authored Nov 29, 2024
1 parent 38ab17e commit d56f1d8
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 1 deletion.
23 changes: 23 additions & 0 deletions app/components/Kopfzeile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default function Kopfzeile() {

This comment has been minimized.

Copy link
@aaschlote

aaschlote Nov 29, 2024

Contributor

should name the component in german? English would be better?

Can you add unit test later?

return (
<div
className="px-16 flex items-center text-left gap-8 sm:gap-16 text-xs sm:text-base"
style={{
backgroundColor: "#f0f0f0",
fontFamily: "FiraSans, Calibri, Verdana, Arial, Helvetica, sans-serif",
}}
>
<span
aria-hidden="true"
className="flex border-solid h-12 sm:h-16 border-white border"
>
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 16">
<path fill="#000" d="M0 .5h24v5.333H0z" />
<path fill="red" d="M0 5.833h24v5.333H0z" />
<path fill="#FACA2C" d="M0 11.167h24V16.5H0z" />
</svg>
</span>
<span>Eine offizielle Website der Bundesrepublik Deutschland</span>
</div>

This comment has been minimized.

Copy link
@aaschlote

aaschlote Nov 29, 2024

Contributor

can we move this text later to Strapi?

);
}
4 changes: 4 additions & 0 deletions app/components/PageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import LocalLibrary from "@digitalservicebund/icons/LocalLibrary";
import SignLanguage from "@digitalservicebund/icons/SignLanguage";
import Kopfzeile from "~/components/Kopfzeile";
import { StandaloneLink } from "~/components/StandaloneLink";

type PageHeaderProps = {
title: string;
linkLabel: string;
hideLinks: boolean;
showKopfzeile?: boolean;
translations: {
leichtesprache: string;
gebaerdensprache: string;
Expand All @@ -18,9 +20,11 @@ export default function Header({
linkLabel,
hideLinks,
translations,
showKopfzeile,
}: Readonly<PageHeaderProps>) {
return (
<header>
{showKopfzeile && <Kopfzeile />}
<nav
className="py-20 px-16 flex flex-wrap justify-between"
aria-label={translations.mainNavigationAriaLabel}
Expand Down
4 changes: 4 additions & 0 deletions app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
fetchTranslations,
} from "~/services/cms/index.server";
import { config as configWeb } from "~/services/env/web";
import { isFeatureFlagEnabled } from "~/services/featureFlags";
import Breadcrumbs from "./components/Breadcrumbs";
import { CookieBanner } from "./components/cookieBanner/CookieBanner";
import Footer from "./components/Footer";
Expand Down Expand Up @@ -95,6 +96,7 @@ export const loader = async ({ request, context }: LoaderFunctionArgs) => {
videoTranslations,
accessibilityTranslations,
mainSession,
showKopfzeile,
] = await Promise.all([
fetchSingleEntry("page-header"),
fetchSingleEntry("footer"),
Expand All @@ -109,6 +111,7 @@ export const loader = async ({ request, context }: LoaderFunctionArgs) => {
fetchTranslations("video"),
fetchTranslations("accessibility"),
mainSessionFromCookieHeader(cookieHeader),
isFeatureFlagEnabled("showKopfzeile"),
]);

const shouldAddCacheControl = shouldSetCacheControlHeader(
Expand All @@ -121,6 +124,7 @@ export const loader = async ({ request, context }: LoaderFunctionArgs) => {
header: {
...getPageHeaderProps(strapiHeader),
hideLinks: flowIdFromPathname(pathname) !== undefined, // no headerlinks on flow pages
showKopfzeile,
},
footer: getFooterProps(strapiFooter),
cookieBannerContent: cookieBannerContent,
Expand Down
3 changes: 2 additions & 1 deletion app/services/featureFlags/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export type FeatureFlag =
| "showFluggastrechteFormular"
| "showGeldEinklagenFlow"
| "showProzesskostenhilfeFlow"
| "showERV";
| "showERV"
| "showKopfzeile";

export const isFeatureFlagEnabled = async (featureFlag: FeatureFlag) => {
const { POSTHOG_API_KEY, POSTHOG_API_HOST } = config();
Expand Down
8 changes: 8 additions & 0 deletions app/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ body {
min-height: 100vh;
}

@font-face {
font-family: FiraSans;
font-style: normal;
font-weight: 400;
font-display: swap;
src: url("/fonts/FiraSans-Regular.woff2") format("woff2");
}

a {
color: currentcolor;
}
Expand Down
Binary file added public/fonts/FiraSans-Regular.woff2
Binary file not shown.
14 changes: 14 additions & 0 deletions stories/Kopfzeile.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Kopfzeile from "~/components/Kopfzeile";
import type { Meta, StoryObj } from "@storybook/react";

const meta = {
title: "Component/Kopfzeile",
component: Kopfzeile,
tags: ["autodocs"],
} satisfies Meta<typeof Kopfzeile>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Default: Story = {};

0 comments on commit d56f1d8

Please sign in to comment.