-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from coopsdev/icon-row
Icon Row + Container blocks
- Loading branch information
Showing
15 changed files
with
453 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import React from 'react' | ||
import { Metadata } from 'next' | ||
import Link from 'next/link' | ||
|
||
import { IconRow } from '../../../../app/_blocks/IconRow' | ||
import { Gutter } from '../../../_components/Gutter' | ||
import { VerticalPadding } from '../../../_components/VerticalPadding' | ||
import { mergeOpenGraph } from '../../../_utilities/mergeOpenGraph' | ||
|
||
// Example data for IconRow | ||
const exampleIconRow = { | ||
blockType: 'iconRow' as 'iconRow', | ||
blockName: 'Icon Row', | ||
introContent: [], | ||
subheading: 'Example Subheading', | ||
icons: [ | ||
{ iconTitle: 'Icon 1', iconImage: { url: '/path/to/icon1.jpg' } }, | ||
{ iconTitle: 'Icon 2', iconImage: { url: '/path/to/icon2.jpg' } }, | ||
], | ||
} | ||
|
||
export default function IconRowStyleguide() { | ||
return ( | ||
<Gutter> | ||
<VerticalPadding bottom="large" top="none"> | ||
<h1>Icon Row Example</h1> | ||
<IconRow {...exampleIconRow} /> | ||
<Link href="/styleguide">Back to Styleguide</Link> | ||
</VerticalPadding> | ||
</Gutter> | ||
) | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: 'Icon Row Styleguide', | ||
description: 'Showcasing the Icon Row component.', | ||
openGraph: mergeOpenGraph({ | ||
title: 'Icon Row Styleguide', | ||
url: '/styleguide/icon-row', | ||
}), | ||
} |
46 changes: 46 additions & 0 deletions
46
src/app/(pages)/styleguide/icon-row-container-block/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from 'react' | ||
import { Metadata } from 'next' | ||
import Link from 'next/link' | ||
|
||
import { IconRowContainer } from '../../../_blocks/IconRowContainer' | ||
import { Gutter } from '../../../_components/Gutter' | ||
import { VerticalPadding } from '../../../_components/VerticalPadding' | ||
import { mergeOpenGraph } from '../../../_utilities/mergeOpenGraph' | ||
|
||
// Example data for IconRowContainer, possibly including multiple IconRows | ||
const iconRowContainerData = { | ||
blockType: 'iconRowContainer' as 'iconRowContainer', | ||
blockName: 'Icon Row Container', | ||
introContent: [], | ||
mainHeading: 'Main Heading Example', | ||
rows: [ | ||
{ | ||
subheading: 'Subheading 1', | ||
icons: [ | ||
{ iconTitle: 'Icon 1', iconImage: { url: '/path/to/icon1.jpg' } }, | ||
{ iconTitle: 'Icon 2', iconImage: { url: '/path/to/icon2.jpg' } }, | ||
], | ||
}, | ||
], | ||
} | ||
|
||
export default function IconRowContainerStyleguide() { | ||
return ( | ||
<Gutter> | ||
<VerticalPadding bottom="large" top="none"> | ||
<h1>Icon Row Container Example</h1> | ||
<IconRowContainer {...iconRowContainerData} /> | ||
<Link href="/styleguide">Back to Styleguide</Link> | ||
</VerticalPadding> | ||
</Gutter> | ||
) | ||
} | ||
|
||
export const metadata: Metadata = { | ||
title: 'Icon Row Container Styleguide', | ||
description: 'Showcasing the Icon Row Container component.', | ||
openGraph: mergeOpenGraph({ | ||
title: 'Icon Row Container Styleguide', | ||
url: '/styleguide/icon-row-container', | ||
}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.iconRow { | ||
padding: 20px; | ||
background-color: #f0f0f0; // example background color | ||
|
||
h3 { | ||
margin-bottom: 10px; | ||
} | ||
|
||
.iconsContainer { | ||
display: flex; | ||
justify-content: space-around; | ||
} | ||
|
||
.icon { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
padding: 10px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react' | ||
import Image from 'next/image' | ||
|
||
import { Media as MediaType } from '../../../payload/payload-types' | ||
import { Gutter } from '../../_components/Gutter' | ||
import { Media } from '../../_components/Media' | ||
import RichText from '../../_components/RichText' | ||
|
||
import classes from './index.module.scss' | ||
|
||
export type Icon = { | ||
iconTitle: string | ||
iconImage: { | ||
url?: string | ||
media?: MediaType | ||
} | ||
} | ||
|
||
export type IconRowProps = { | ||
blockType?: 'iconRow' | ||
blockName?: string | ||
introContent?: any | ||
subheading: string | ||
icons?: Icon[] | ||
} | ||
|
||
export const IconRow: React.FC<IconRowProps> = ({ introContent, subheading, icons }) => { | ||
return ( | ||
<div className={classes.iconRow}> | ||
<Gutter> | ||
{introContent && ( | ||
<Gutter className={classes.introContent}> | ||
<RichText content={introContent} /> | ||
</Gutter> | ||
)} | ||
<h3>{subheading}</h3> | ||
<div className={classes.iconsContainer}> | ||
{icons.map((icon, index) => ( | ||
<div key={index} className={classes.icon}> | ||
<Media resource={icon.iconImage.media ?? icon.iconImage.url} /> | ||
<p>{icon.iconTitle}</p> | ||
</div> | ||
))} | ||
</div> | ||
</Gutter> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.iconRowContainer { | ||
background-color: #e0e0e0; // example background color | ||
|
||
h2 { | ||
padding: 20px; | ||
text-align: center; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react' | ||
|
||
import { Gutter } from '../../_components/Gutter' | ||
import RichText from '../../_components/RichText' | ||
import { IconRow, IconRowProps } from '../IconRow' | ||
|
||
import classes from './index.module.scss' | ||
|
||
export type IconRowContainerProps = { | ||
blockType?: 'iconRowContainer' | ||
blockName?: string | ||
introContent?: any | ||
mainHeading?: string | ||
rows?: IconRowProps[] | ||
} | ||
|
||
export const IconRowContainer: React.FC<IconRowContainerProps> = (props: IconRowContainerProps) => { | ||
const { introContent, mainHeading, rows } = props | ||
return ( | ||
<div className={classes.iconRowContainer}> | ||
<Gutter> | ||
{introContent && ( | ||
<Gutter className={classes.introContent}> | ||
<RichText content={introContent} /> | ||
</Gutter> | ||
)} | ||
<h2>{mainHeading}</h2> | ||
{rows.map((row, index) => ( | ||
<IconRow key={index} subheading={row.subheading} icons={row.icons} /> | ||
))} | ||
</Gutter> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { Block } from 'payload/types' | ||
|
||
import richText from '../../fields/richText' | ||
|
||
export const IconRow: Block = { | ||
slug: 'iconRow', | ||
fields: [ | ||
richText({ | ||
name: 'introContent', | ||
label: 'Intro Content', | ||
}), | ||
{ | ||
name: 'subheading', | ||
type: 'text', | ||
required: true, | ||
}, | ||
{ | ||
name: 'icons', | ||
type: 'array', | ||
fields: [ | ||
{ | ||
name: 'iconTitle', | ||
type: 'text', | ||
required: true, | ||
}, | ||
{ | ||
name: 'iconImage', | ||
type: 'upload', | ||
relationTo: 'media', | ||
required: true, | ||
}, | ||
], | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import type { Block } from 'payload/types' | ||
|
||
import richText from '../../fields/richText' | ||
import { IconRow } from '../IconRow' | ||
|
||
export const IconRowContainer: Block = { | ||
slug: 'iconRowContainer', | ||
fields: [ | ||
richText({ | ||
name: 'introContent', | ||
label: 'Intro Content', | ||
}), | ||
{ | ||
name: 'mainHeading', | ||
type: 'text', | ||
required: true, | ||
}, | ||
{ | ||
name: 'rows', | ||
type: 'blocks', | ||
blocks: [IconRow], | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.