-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'bose/2581' into staging
- Loading branch information
Showing
8 changed files
with
152 additions
and
0 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,71 @@ | ||
import { view_module } from '@equinor/eds-icons' | ||
import { EdsIcon } from '../../icons' | ||
import { SchemaType } from '../../types' | ||
import { configureBlockContent } from '../editors' | ||
|
||
const blockContentType = configureBlockContent({ | ||
h2: false, | ||
h3: true, | ||
h4: true, | ||
attachment: false, | ||
}) | ||
|
||
export default { | ||
type: 'object', | ||
name: 'stickyTextBlocks', | ||
title: 'Sticky text blocks', | ||
fieldsets: [ | ||
{ | ||
name: 'design', | ||
title: 'Design options', | ||
}, | ||
], | ||
fields: [ | ||
{ | ||
type: 'array', | ||
name: 'blockGroup', | ||
title: 'List of text block', | ||
of: [ | ||
{ | ||
name: 'textBlock', | ||
title: 'Text block', | ||
type: 'object', | ||
fields: [ | ||
{ | ||
name: 'title', | ||
title: 'Title heading', | ||
type: 'string', | ||
description: 'Heading that will stay sticky until side content is scrolled by', | ||
}, | ||
{ | ||
name: 'content', | ||
title: 'Text content', | ||
type: 'array', | ||
of: [blockContentType], | ||
}, | ||
], | ||
}, | ||
], | ||
validation: (Rule: SchemaType.ValidationRule) => Rule.required(), | ||
}, | ||
{ | ||
title: 'Background', | ||
description: 'Pick a colour for the background. Default is white.', | ||
name: 'background', | ||
type: 'colorlist', | ||
fieldset: 'design', | ||
}, | ||
], | ||
preview: { | ||
select: { | ||
group: 'blockGroup', | ||
}, | ||
prepare({ group }: any) { | ||
return { | ||
title: 'Sticky textblocks', | ||
subtitle: `${group ? group.length : 0} textblocks`, | ||
media: <div>{EdsIcon(view_module)}</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
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,39 @@ | ||
import { BackgroundContainer } from '@components/Backgrounds' | ||
import { Typography } from '@core/Typography' | ||
import Blocks from '../../pageComponents/shared/portableText/Blocks' | ||
import { twMerge } from 'tailwind-merge' | ||
import { PortableTextBlock } from '@portabletext/types' | ||
import { StickyTextBlocksData } from '../../types/types' | ||
|
||
export type StickyTextBlocksProps = { | ||
data: StickyTextBlocksData | ||
anchor?: string | ||
className?: string | ||
} | ||
const StickyTextBlocks = ({ data, anchor, className }: StickyTextBlocksProps) => { | ||
const { group, designOptions } = data | ||
return ( | ||
<BackgroundContainer {...designOptions} className={twMerge(`pb-page-content px-layout-sm`, className)} id={anchor}> | ||
{group?.length > 0 && | ||
group?.map((textBlock: { id: string; title?: string; content: PortableTextBlock[] }) => { | ||
return ( | ||
<section | ||
key={textBlock?.id} | ||
className="lg:grid lg:grid-cols-[30%_70%] gap-24 py-12 border-y-2 border-energy-red-100" | ||
> | ||
{textBlock?.title && ( | ||
<Typography variant="h2" className="h-max lg:sticky top-32 text-pretty"> | ||
{textBlock.title} | ||
</Typography> | ||
)} | ||
<div className="max-w-text"> | ||
{textBlock?.content && <Blocks value={textBlock.content} className="flex flex-col" />} | ||
</div> | ||
</section> | ||
) | ||
})} | ||
</BackgroundContainer> | ||
) | ||
} | ||
|
||
export default StickyTextBlocks |
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,2 @@ | ||
//"use client"; | ||
export { default as StickyTextBlocks, type StickyTextBlocksProps } from './StickyTextBlocks' |
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