Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasvarone committed Jan 8, 2024
1 parent 4840ebd commit 4ae0746
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {imageSchema} from './image.model'
import {imageSchema} from '@/models/image.model'
import {z} from 'zod'

export const contentAlternatePositionWithImageSchema = z.object({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,32 @@
import {ContentAlternatePositionWithImage} from '@/models/content-alternate-position-with-image'
import {ContentAlternatePositionWithImage} from '@/components/ui/organisms/content-sections/content-alternate-position-with-image-item/content-alternate-position-with-image.model'
import {cn} from '@/utils/toolbox'
import Button from '@/components/ui/atoms/button'
import Image from 'next/image'
import Link from 'next/link'

export type ContentAlternatePositionWithImageItemProps = {
items: Array<ContentAlternatePositionWithImage>
}

export default function ContentAlternatePositionWithImageItem(props: ContentAlternatePositionWithImageItemProps) {
export default function ContentAlternatePositionWithImageItem(props: ContentAlternatePositionWithImage) {
return (
<div className='py-20 lg:py-[104px]'>
<div className='relative px-6 mx-auto max-w-7xl lg:px-8'>
{props.items?.map((item, index) => (
<div
key={index}
className='flex flex-col items-center lg:flex-row gap-y-10 lg:gap-x-16'
>
<div className={cn(item.imagePosition === 'left' ? 'order-1' : 'order-2', 'w-full lg:w-1/3 h-72')}>
<Image
className='object-cover w-full h-full rounded-xl'
src={item.image.url}
width={item.image.width}
height={item.image.height}
alt={item.image.alternateText || item.image.name}
></Image>
</div>
<div className='flex flex-col w-full lg:w-2/3 gap-y-2'>
<h2 className='text-2xl font-medium text-white sm:text-3xl'>{item.title}</h2>
<p className='text-[18px] leading-8 text-slate-400 font-light'>{item.description}</p>
<Button
asChild
size='medium'
shape='circle'
className='px-5 mt-4 text-md bg-sky-300 text-slate-900 hover:bg-violet-300'
>
<Link href={item.slug}>Learn more</Link>
</Button>
</div>
</div>
))}
<div className='flex flex-col items-center lg:flex-row gap-y-10 lg:gap-x-16'>
<div className={cn(props.imagePosition === 'left' ? 'order-1' : 'order-2', 'w-full lg:w-1/3 h-72')}>
<Image
className='object-cover w-full h-full rounded-xl'
src={props.image.url}
width={props.image.width}
height={props.image.height}
alt={props.image.alternateText || props.image.name}
></Image>
</div>
<div className='flex flex-col w-full lg:w-2/3 gap-y-2'>
<h2 className='text-2xl font-medium text-white sm:text-3xl'>{props.title}</h2>
<p className='text-[18px] leading-8 text-slate-400 font-light'>{props.description}</p>
<Button
asChild
size='medium'
shape='circle'
className='px-5 mt-4 text-md bg-sky-300 text-slate-900 hover:bg-violet-300'
>
<Link href={props.slug}>Learn more</Link>
</Button>
</div>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import {ContentAlternatePositionWithImage} from '@/models/content-alternate-position-with-image'
import {ContentAlternatePositionWithImage} from '@/components/ui/organisms/content-sections/content-alternate-position-with-image-item/content-alternate-position-with-image.model'
import ContentAlternatePositionWithImageItem from '@/components/ui/organisms/content-sections/content-alternate-position-with-image-item'

export type ContentAlternatePositionWithImageListProps = {
items: Array<ContentAlternatePositionWithImage>
}

export default function ContentAlternatePositionWithImageList(props: ContentAlternatePositionWithImageListProps) {
const items = props.items.map((item) => {
return {
image: item.image,
title: item.title,
description: item.description,
imagePosition: item.imagePosition,
slug: item.slug
}
})

return <ContentAlternatePositionWithImageItem items={items} />
return (
<div className='py-20 lg:py-[104px]'>
<div className='relative px-6 mx-auto max-w-7xl lg:px-8'>
{props.items.map((item, index) => (
<ContentAlternatePositionWithImageItem
key={index}
{...item}
/>
))}
</div>
</div>
)
}

0 comments on commit 4ae0746

Please sign in to comment.