From 25f8dd12cbde2914ef2745549af1d23f5be2de26 Mon Sep 17 00:00:00 2001 From: Andy Leuchtturm <d-leuchtturm@gmx.net> Date: Thu, 28 Sep 2023 11:17:03 +0200 Subject: [PATCH] Implement LifecyclePicture - hopefully working... --- .../{ServiceTagLifecycle.tsx => LifecyclePicture.tsx} | 9 +++------ components/it-standards/ServiceTag.tsx | 4 ++-- pages/standards/index.tsx | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) rename components/it-standards/{ServiceTagLifecycle.tsx => LifecyclePicture.tsx} (68%) diff --git a/components/it-standards/ServiceTagLifecycle.tsx b/components/it-standards/LifecyclePicture.tsx similarity index 68% rename from components/it-standards/ServiceTagLifecycle.tsx rename to components/it-standards/LifecyclePicture.tsx index e8574c9..095e490 100644 --- a/components/it-standards/ServiceTagLifecycle.tsx +++ b/components/it-standards/LifecyclePicture.tsx @@ -1,18 +1,15 @@ import { Tag } from 'types/content/' import Image from 'next/image' -type tag = { - myTag: Tag; // Deklarieren Sie die Prop myTag hier -} -export default function Lifecycle({ myTag }:tag) { +export default function LifecyclePicture(lifecyclephase:Tag) { /* beim tag 'status' soll das zugehörige Lebenszyklus-Bild ausgegeben werden */ - const imagePath = `/img/standards/lifecycle/${myTag.value}.svg` + const imagePath = `/img/standards/lifecycle/${lifecyclephase.value}.svg` return ( <div className="border border-gray-300 rounded-lg overflow-hidden py-2"> {/* Die Next.js Image-Komponente verwendet das "src" Attribut */} <Image src={imagePath} - alt={`Bild für Tag ${myTag.value}`} + alt={`Bild für Tag ${lifecyclephase.value}`} width={500} // Breite des Bildes height={0} // Höhe des Bildes /> diff --git a/components/it-standards/ServiceTag.tsx b/components/it-standards/ServiceTag.tsx index 08c9fe2..a174f41 100644 --- a/components/it-standards/ServiceTag.tsx +++ b/components/it-standards/ServiceTag.tsx @@ -1,7 +1,7 @@ import Chip from '@/components/Chip' import { Tag } from 'types/content/' import { translateLabel, translateTag } from '@/lib/utils/labelHelper' -import Lifecycle from '@/components/it-standards/ServiceTagLifecycle' +import LifecyclePicture from '@/components/it-standards/LifecyclePicture' type ServiceTagOptions = { tag: Tag, @@ -16,7 +16,7 @@ export default ({ tag, style }: ServiceTagOptions) => { /* beim tag 'status' soll das zugehörige Lebenszyklus-Bild ausgegeben werden */ if (tag.name == 'status') { return ( - <Lifecycle myTag={tag} /> + <LifecyclePicture {...tag } /> ) } return ( diff --git a/pages/standards/index.tsx b/pages/standards/index.tsx index 42a630e..44fbc8e 100644 --- a/pages/standards/index.tsx +++ b/pages/standards/index.tsx @@ -12,7 +12,7 @@ import { handleMailtoEvent, encodeEmail } from '@/lib/utils' import { remark } from 'remark' import html from 'remark-html' import Tooltip from '@/components/Tooltip' -import ServiceTag from '@/components/ServiceTag' +import ServiceTag from '@/components/it-standards/ServiceTag' import Chip from '@/components/Chip' import Link from 'next/link' -- GitLab