@@ -6,10 +6,16 @@ import dynamic from "next/dynamic"
66import { twMerge } from "tailwind-merge"
77import { useRouter } from "next/router"
88import { allLowercase } from "@/utils"
9+ import Link from "next/link"
10+ import GalleryFullWidth from "./GalleryFullWidth"
911
1012const Image = dynamic ( ( ) => import ( "next/image" ) )
11- const zoomOut = [ ]
12- const Gallery = ( { title, gallery, reverseLayout} : GalleryBlock ) => {
13+ const Gallery = ( {
14+ title,
15+ gallery,
16+ fullWidthLayout,
17+ reverseLayout,
18+ } : GalleryBlock ) => {
1319 const params = useRouter ( ) . asPath
1420 const ref = useRef ( null )
1521 // const isMobile = useMediaQuery("()")
@@ -51,10 +57,22 @@ const Gallery = ({title, gallery, reverseLayout}: GalleryBlock) => {
5157 }
5258 }
5359 } , [ params ] )
60+
61+ const linkToUri = ( link : string ) => {
62+ return link . replace ( "https://www.vulcanus-stahl.de" , "" )
63+ }
64+ if ( fullWidthLayout )
65+ return (
66+ < GalleryFullWidth
67+ title = { title }
68+ reverseLayout = { reverseLayout }
69+ gallery = { gallery }
70+ />
71+ )
5472 return (
55- < div ref = { ref } className = "relative py-14 md:py-20 lg:pb-28 " >
73+ < div ref = { ref } className = "relative py-14 md:py-20 lg:pb-24 " >
5674 < div className = "relative" >
57- < img
75+ < Image
5876 src = { "/shapes/left-shape.svg" }
5977 width = { 47 }
6078 height = { 155 }
@@ -63,33 +81,51 @@ const Gallery = ({title, gallery, reverseLayout}: GalleryBlock) => {
6381 />
6482
6583 < div className = "container-fluid grid grid-cols-12 gap-5 gap-y-6 lg:gap-6" >
66- < div className = "relative col-span-full flex justify-start text-left md:justify-start xl:col-span-3 2xl:col-span-3" >
67- < h2 className = "max-w-[579px] whitespace-pre-wrap break-words text-left text-2xl font-bold tracking-tight md:ml-[50px] xl:ml-10 xl:text-left xl:text-2xl 2xl:w-[4/5 ] 2xl:text-3xl 3xl:text-4xl 3xl:leading-[67px ]" >
84+ < div className = "relative col-span-full flex flex-col justify-start text-left md:justify-start xl:col-span-3 2xl:col-span-3" >
85+ < h2 className = "max-w-[579px] text-left text-3xl font-bold md:ml-[50px] xl:ml-10 xl:text-left xl:text-5xl xl:leading-[67px ] 2xl:w-[4/5 ]" >
6886 { title }
6987 </ h2 >
88+ < div className = "mb-10 md:ml-[50px] xl:mb-0 xl:ml-10" >
89+ { gallery ?. map ( ( ele , id ) => {
90+ if ( ele ?. textOrImge === "text" )
91+ return (
92+ < >
93+ < div className = "" key = { id } >
94+ < h2 className = "mb-8 text-xl font-bold text-primary-blue-200" >
95+ { ele ?. text ?. title }
96+ </ h2 >
97+ < p className = "text-primary-blue-200" >
98+ { ele ?. text ?. content }
99+ </ p >
100+ </ div >
101+ { ele ?. text ?. button && (
102+ < Link
103+ href = { linkToUri ( ele ?. text ?. button ?. url || "/" ) }
104+ className = "fit-content mt-8 inline-flex w-[fit-content] items-center justify-center whitespace-nowrap bg-primary-blue-main px-10 py-[17px] text-center font-bold uppercase leading-[125%] text-secondary-offWhite-white transition-all duration-300 hover:bg-primary-blue-400 lg:px-[60px] xl:mt-16" >
105+ { ele ?. text ?. button ?. title }
106+ </ Link >
107+ ) }
108+ </ >
109+ )
110+ } ) }
111+ </ div >
70112 </ div >
71113 < div
72114 className = { `col-span-full grid grid-cols-6 gap-5 md:ml-[50px] lg:col-span-11 lg:grid-cols-8 xl:col-span-8 xl:col-start-5 xl:ml-0 ` } >
73115 { gallery ?. map ( ( ele , id ) => {
74- return (
75- < div
76- key = { id }
77- className = { twMerge (
78- "col-span-full flex flex-col justify-start gap-3 rounded-[5px] border border-primary-blue-main p-3 sm:col-span-3 sm:p-3 lg:col-span-2 xl:p-5 3xl:p-6 " ,
79- ! reverseLayout
80- ? id === 1 || id === 2
81- ? "lg:col-span-5"
82- : "lg:col-span-3 "
83- : id === 0 || id === 3
84- ? "lg:col-span-5"
85- : "lg:col-span-3" ,
86- id === 2 && gallery . length < 4 ? "lg:col-span-full" : "" ,
87- ele ?. textOrImge === "text" &&
88- "border-none bg-primary-blue-100 text-primary-midBlue-main"
89- ) } >
90- { ele ?. textOrImge === "image" ? (
116+ if ( ele ?. textOrImge === "image" )
117+ return (
118+ < div
119+ key = { id }
120+ className = { twMerge (
121+ "col-span-full flex flex-col justify-start gap-3 rounded-[5px] border border-primary-blue-main p-3 sm:col-span-3 sm:p-3 lg:col-span-2 xl:p-5 3xl:p-6 " ,
122+ id === 0 && "lg:col-span-3" ,
123+ id === 1 && "lg:col-span-5" ,
124+
125+ id === 2 && "lg:col-span-8"
126+ ) } >
91127 < >
92- < div className = "relative h-[390px ] w-full overflow-hidden lg:h-[420px] 2xl:h-[500px] 3xl:h-[550px] " >
128+ < div className = "relative h-[352px ] w-full overflow-hidden" >
93129 < div className = "relative h-full w-full" >
94130 < Image
95131 fill
@@ -106,18 +142,8 @@ const Gallery = ({title, gallery, reverseLayout}: GalleryBlock) => {
106142 { ele ?. imageTitle }
107143 </ p >
108144 </ >
109- ) : (
110- < div className = "[&>p]:text-lg [&>p]:leading-[24px]" >
111- < h3 className = "mb-3 text-xl font-bold text-primary-midBlue-main 2xl:text-2xl" >
112- { ele ?. text ?. title }
113- </ h3 >
114- < p className = "text-base xl:text-lg" >
115- { ele ?. text ?. content }
116- </ p >
117- </ div >
118- ) }
119- </ div >
120- )
145+ </ div >
146+ )
121147 } ) }
122148 </ div >
123149 </ div >
0 commit comments