generated from digitalservicebund/remix-application-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
9 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
packages/dito/app/routes/digitaltauglichkeit.prinzipien.$prinzip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Background from "@digitalcheck/shared/components/Background.tsx"; | ||
import Container from "@digitalcheck/shared/components/Container.tsx"; | ||
import { json, useLoaderData, useOutletContext } from "@remix-run/react"; | ||
|
||
import DetailInfo from "@digitalcheck/shared/components/DetailInfo.tsx"; | ||
import { LoaderFunction } from "@remix-run/node"; | ||
import { type Prinzip } from "../utils/strapiData.server.ts"; | ||
|
||
export const loader: LoaderFunction = async ({ params }) => { | ||
const slug = params.prinzip; | ||
if (!slug) throw new Response("Prinzip not found", { status: 404 }); | ||
return json({ slug }); | ||
}; | ||
|
||
export default function Digitaltauglichkeit_Prinzipien_Detail() { | ||
const { slug } = useLoaderData<typeof loader>(); | ||
const prinzips: Prinzip[] = useOutletContext(); | ||
const prinzip = prinzips.find((prinzip) => prinzip.slug === slug); | ||
if (!prinzip) { | ||
return ( | ||
<Background backgroundColor="blue"> | ||
<Container> | ||
<h1>Prinzip not found</h1> | ||
<p>Sorry, the requested principle could not be found.</p> | ||
</Container> | ||
</Background> | ||
); | ||
} | ||
return ( | ||
<> | ||
<Container> | ||
<DetailInfo label={["asa", "abc"]} /> | ||
|
||
<h2>All Properties:</h2> | ||
<ul> | ||
{Object.entries(prinzip).map(([key, value]) => ( | ||
<li key={key}> | ||
<strong>{key}:</strong> {JSON.stringify(value, null, 2)} | ||
</li> | ||
))} | ||
</ul> | ||
</Container> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters