Skip to content

Commit

Permalink
Create content alternative position image left and right
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasvarone committed Dec 26, 2023
1 parent 0a59a5d commit 8e4d781
Show file tree
Hide file tree
Showing 14 changed files with 327 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apps/cms/config/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default ({env}) => ({
provider: 'deepl',
providerOptions: {
apiKey: env('DEEPL_API_KEY'),
apiUrl: 'https://api.deepl.com',
apiUrl: 'https://api-free.deepl.com',
localeMap: {
EN: 'EN-US'
},
Expand Down
4 changes: 3 additions & 1 deletion apps/cms/src/api/service/content-types/service/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
"solution-sections.solution-three-column-with-large-icons",
"content-section.content-markdown",
"contact-sections.contact-split-with-pattern",
"service-sections.service-alternate-position-icon"
"service-sections.service-alternate-position-icon",
"content-section.content-alternate-position-image-left",
"content-section.content-alternate-position-image-right"
]
},
"icon": {
Expand Down
3 changes: 2 additions & 1 deletion apps/cms/src/api/solution/content-types/solution/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
"solution-sections.solution-three-column-with-large-icons",
"content-section.content-markdown",
"contact-sections.contact-split-with-pattern",
"solution-sections.solution-one-column"
"solution-sections.solution-one-column",
"solution-sections.solution-alternate-position-image"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"collectionName": "content_alternate_position_image_left",
"info": {
"displayName": "content-alternate-position-image-left"
},
"options": {},
"attributes": {
"title": {
"type": "string",
"required": true
},
"description": {
"type": "text",
"required": true
},
"image": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false,
"required": true
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"collectionName": "content_alternate_position_image_right",
"info": {
"displayName": "content-alternate-position-image-right"
},
"options": {},
"attributes": {
"title": {
"type": "string",
"required": true
},
"description": {
"type": "text",
"required": true
},
"image": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false,
"required": true
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"collectionName": "solution_alternate_position_image",
"info": {
"displayName": "solution-alternate-position-image"
},
"options": {},
"attributes": {
"solutions": {
"type": "relation",
"relation": "oneToMany",
"target": "api::solution.solution"
}
}
}
44 changes: 44 additions & 0 deletions apps/cms/types/generated/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,32 @@ export interface ContactSectionsContactSplitWithPattern
};
}

export interface ContentSectionContentAlternatePositionImageLeft
extends Schema.Component {
collectionName: 'content_alternate_position_image_left';
info: {
displayName: 'content-alternate-position-image-left';
};
attributes: {
title: Attribute.String & Attribute.Required;
description: Attribute.Text & Attribute.Required;
image: Attribute.Media & Attribute.Required;
};
}

export interface ContentSectionContentAlternatePositionImageRight
extends Schema.Component {
collectionName: 'content_alternate_position_image_right';
info: {
displayName: 'content-alternate-position-image-right';
};
attributes: {
title: Attribute.String & Attribute.Required;
description: Attribute.Text & Attribute.Required;
image: Attribute.Media & Attribute.Required;
};
}

export interface ContentSectionContentMarkdown extends Schema.Component {
collectionName: 'components_content_section_content_markdowns';
info: {
Expand Down Expand Up @@ -598,6 +624,21 @@ export interface ServiceSectionsServiceThreeColumnWithLargeIcons
};
}

export interface SolutionSectionsSolutionAlternatePositionImage
extends Schema.Component {
collectionName: 'solution_alternate_position_image';
info: {
displayName: 'solution-alternate-position-image';
};
attributes: {
solutions: Attribute.Relation<
'solution-sections.solution-alternate-position-image',
'oneToMany',
'api::solution.solution'
>;
};
}

export interface SolutionSectionsSolutionOneColumn extends Schema.Component {
collectionName: 'solution_one_column';
info: {
Expand Down Expand Up @@ -680,6 +721,8 @@ declare module '@strapi/types' {
'blog-sections.blog-three-column': BlogSectionsBlogThreeColumn;
'cards.card-with-icon': CardsCardWithIcon;
'contact-sections.contact-split-with-pattern': ContactSectionsContactSplitWithPattern;
'content-section.content-alternate-position-image-left': ContentSectionContentAlternatePositionImageLeft;
'content-section.content-alternate-position-image-right': ContentSectionContentAlternatePositionImageRight;
'content-section.content-markdown': ContentSectionContentMarkdown;
'content-section.content-two-column': ContentSectionContentTwoColumn;
'content-section.introduction-with-logo': ContentSectionIntroductionWithLogo;
Expand All @@ -697,6 +740,7 @@ declare module '@strapi/types' {
'seo.seo': SeoSeo;
'service-sections.service-alternate-position-icon': ServiceSectionsServiceAlternatePositionIcon;
'service-sections.service-three-column-with-large-icons': ServiceSectionsServiceThreeColumnWithLargeIcons;
'solution-sections.solution-alternate-position-image': SolutionSectionsSolutionAlternatePositionImage;
'solution-sections.solution-one-column': SolutionSectionsSolutionOneColumn;
'solution-sections.solution-three-column-with-large-icons': SolutionSectionsSolutionThreeColumnWithLargeIcons;
'team-sections.team-three-column': TeamSectionsTeamThreeColumn;
Expand Down
7 changes: 5 additions & 2 deletions apps/cms/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,9 @@ export interface ApiServiceService extends Schema.CollectionType {
'solution-sections.solution-three-column-with-large-icons',
'content-section.content-markdown',
'contact-sections.contact-split-with-pattern',
'service-sections.service-alternate-position-icon'
'service-sections.service-alternate-position-icon',
'content-section.content-alternate-position-image-left',
'content-section.content-alternate-position-image-right'
]
> &
Attribute.SetPluginOptions<{
Expand Down Expand Up @@ -1403,7 +1405,8 @@ export interface ApiSolutionSolution extends Schema.CollectionType {
'solution-sections.solution-three-column-with-large-icons',
'content-section.content-markdown',
'contact-sections.contact-split-with-pattern',
'solution-sections.solution-one-column'
'solution-sections.solution-one-column',
'solution-sections.solution-alternate-position-image'
]
> &
Attribute.SetPluginOptions<{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {ImageProps} from '@/models/image.model'
import Button from '@/components/ui/atoms/button'
import Image from 'next/image'
import Link from 'next/link'

export type ContentAlternatePositionImageLeftProps = {
title: string
description: string
image: ImageProps
}

export default function ContentAlternatePositionImageLeft(props: ContentAlternatePositionImageLeftProps) {
return (
<div className='py-20 lg:py-[104px]'>
<div className='relative px-6 mx-auto max-w-7xl lg:px-8'>
{/* <dl className='grid grid-cols-1 gap-x-6 gap-y-14 lg:gap-y-36'> */}
<div
className='flex flex-col items-center lg:flex-row gap-y-10 lg:gap-x-16'>
<div className='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'>
{/* Is 'dt' useful? */}
<dt className='text-2xl font-medium text-white sm:text-3xl'>
{props.title}
</dt>
{/* Is 'dd' useful? */}
<dd className='text-[18px] leading-8 text-slate-400 font-light'>
<p>{props.description}</p>
</dd>
<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=''>
Learn more
</Link>
</Button>
</div>
</div>
{/* </dl> */}
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {ImageProps} from '@/models/image.model'
import Button from '@/components/ui/atoms/button'
import Image from 'next/image'
import Link from 'next/link'

export type ContentAlternatePositionImageRightProps = {
title: string
description: string
image: ImageProps
}

export default function ContentAlternatePositionImageRight(props: ContentAlternatePositionImageRightProps) {
return (
<div className='py-20 lg:py-[104px]'>
<div className='relative px-6 mx-auto max-w-7xl lg:px-8'>
{/* <dl className='grid grid-cols-1 gap-x-6 gap-y-14 lg:gap-y-36'> */}
<div
className='flex flex-col items-center lg:flex-row gap-y-10 lg:gap-x-16'>
<div className='flex flex-col order-2 w-full lg:w-2/3 gap-y-2 lg:order-1'>
{/* Is 'dt' useful? */}
<dt className='text-2xl font-medium text-white sm:text-3xl'>
{props.title}
</dt>
{/* Is 'dd' useful? */}
<dd className='text-[18px] leading-8 text-slate-400 font-light'>
<p>{props.description}</p>
</dd>
<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=''>
Learn more
</Link>
</Button>
</div>
<div className='order-1 w-full lg:w-1/3 h-72 lg:order-2'>
<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>
{/* </dl> */}
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import {ArrowLongRightIcon} from '@heroicons/react/24/solid'
import {Feature} from '@/models/feature.model'
import {cn} from '@/utils/toolbox'
import Button from '@/components/ui/atoms/button'
import Icon from '@/components/ui/atoms/icon'
import Link from 'next/link'

export type FeatureAlternatePositionImageProps = {
title: string
subtitle: string
features: Array<Feature>
}

export default function FeatureAlternatePositionImage(props: FeatureAlternatePositionImageProps) {
return (
<div className='pb-20 pt-12 lg:pb-[104px] lg:pt-[120px]'>
<div className='relative px-6 mx-auto max-w-7xl lg:px-8'>
<dl className='grid grid-cols-1 gap-x-6 gap-y-14 lg:gap-y-36'>
{props.features?.map((feature, index) => (
<div
key={index}
className='max-w-5xl mx-auto'>
<div
className={cn('flex flex-col items-start lg:flex-row gap-x-10',
index % 2 !== 0 ? 'lg:flex-row-reverse' : '')}>
<div>
<Icon
{...feature.icon}
className='w-auto mb-4 sm:mb-6 h-14 sm:h-24 lg:h-52 lg:mb-0'
strokeWidth={0.75}
>
</Icon>
</div>
<div className='flex flex-col gap-y-2'>
<dt className='text-2xl font-medium text-white sm:text-3xl'>
{feature.title}
</dt>
<dd className='text-[18px] leading-8 text-slate-400 font-light'>
<p>{feature.description}</p>
</dd>
<Button
asChild
size='large'
variant='link'
className='mt-1 text-lg text-sky-300 hover:text-violet-300'
leading={<ArrowLongRightIcon className='w-8 h-8'/>}
>
<Link href={feature.link}>
Learn more
</Link>
</Button>
</div>
</div>
</div>
))}
</dl>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type ServiceAlternatePositionIconProps = {
services: Array<Service>
}

export default function ServiceAlternatePositionIcon(props: ServiceAlternatePositionIconProps) {
export default function ServiceAlternatePositionIcon(props: ServiceAlternatePositionIconProps) {
const features = props.services.map((service) => {
return {
icon: service.icon,
Expand Down
Loading

0 comments on commit 8e4d781

Please sign in to comment.