From 08653768c872b02894cf300d05db9de67af4e75b Mon Sep 17 00:00:00 2001 From: m-vuk Date: Thu, 26 Sep 2024 11:54:48 +0200 Subject: [PATCH] [#612] diagramm positionierung --- .../app/(dashboard)/[city]/page.module.scss | 40 ++++++++-- frontend/app/(dashboard)/[city]/page.tsx | 21 +++--- frontend/app/components/ImageModal.tsx | 75 +++++++++++++++++++ 3 files changed, 119 insertions(+), 17 deletions(-) create mode 100644 frontend/app/components/ImageModal.tsx diff --git a/frontend/app/(dashboard)/[city]/page.module.scss b/frontend/app/(dashboard)/[city]/page.module.scss index dc42b74f..55f5a547 100644 --- a/frontend/app/(dashboard)/[city]/page.module.scss +++ b/frontend/app/(dashboard)/[city]/page.module.scss @@ -2,24 +2,50 @@ flex: 1; } -.mdContent{ +.mdContent { img { max-width: 100%; } } -.checklistContainer{ +.checklistContainer { display: flex; flex-wrap: wrap; gap: 20px; - a{ + + a { flex: 1; max-width: 500px; } } -.charts{ - img{max-width: 100%;} - figure { display: table; margin-left:auto;margin-right: auto;max-width: 90%;margin-top:50px} - figcaption { display: table-caption; caption-side: bottom ; text-align: center;font-size: smaller;} +.charts { + img { + float: left; + margin-right: 15px; + max-width: 60%; + } + + figure { + margin-top: 3z0px; + display: flex; + flex-wrap: wrap; + align-items: flex-start; + } + + figcaption { + flex: 1; + font-size: smaller; + /* Schriftgröße anpassen */ + margin-top: 0; + } + @media screen and (max-width: 600px) { + img { + pointer-events: none; + max-width: 100%; + } + figcaption { + text-align:center; + } + } } \ No newline at end of file diff --git a/frontend/app/(dashboard)/[city]/page.tsx b/frontend/app/(dashboard)/[city]/page.tsx index 4528c991..760cceff 100644 --- a/frontend/app/(dashboard)/[city]/page.tsx +++ b/frontend/app/(dashboard)/[city]/page.tsx @@ -11,6 +11,7 @@ import ImplementationIndicator from "@/app/components/ImplementationIndicator"; import ChecklistIndicator from "@/app/components/ChecklistIndicator"; import type { CheckItem, Chart } from "@/types"; import rehypeRaw from "rehype-raw"; +import ImageModal from "@/app/components/ImageModal"; interface CityDescriptionProps { teaser: string; @@ -96,16 +97,16 @@ export default async function CityDashboard({ params }: { params: { city: string : <> - const charts = Array.isArray(city.charts) ? city.charts.map((chart:Chart, key:number) =>
- {chart.alt_description} -
- {chart.caption} - Quelle: { chart.source } - Lizenz: { chart.license } -
-
) :<> + const charts = Array.isArray(city.charts) ? city.charts.map((chart:Chart, key:number) => + + ) :<> const localgroup = city?.local_group?.description ? = ({ + src, + alt = '', + title = '', + className = '', + license = '', + caption = '', + source = '', + style = {}, +}) => { + const [show, setShow] = useState(false); + + const handleClose = () => setShow(false); + const handleShow = () => setShow(true); + + return ( + <> + {/* Clickable image */} +
+ {title} +
+ {caption} + Quelle: { source } - Lizenz: { license } +
+
+ + {/* Modal for large image */} + + + +
+ {title} +
+ {caption} + Quelle: { source } - Lizenz: { license } +
+
+
+
+ + ); +}; + +export default ImageModal;