Skip to content

Commit

Permalink
Merge branch 'bose/2580' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
BorghildSelle committed Oct 25, 2024
2 parents 7ca9dbf + dc6d476 commit 972db3b
Show file tree
Hide file tree
Showing 14 changed files with 132 additions and 353 deletions.
18 changes: 18 additions & 0 deletions sanityv3/schemas/objects/textWithIconArray.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { view_module } from '@equinor/eds-icons'
import blocksToText from '../../helpers/blocksToText'
import { EdsIcon } from '../../icons'
import CompactBlockEditor from '../components/CompactBlockEditor'
import { SchemaType } from '../../types'
import { configureTitleBlockContent } from '../editors'

const titleContentType = configureTitleBlockContent()

export default {
type: 'object',
Expand All @@ -14,6 +18,20 @@ export default {
},
],
fields: [
{
name: 'title',
type: 'array',
inputComponent: CompactBlockEditor,
of: [titleContentType],
title: 'Title',
description: 'The list of icon/text should have a heading, can be hidden below',
},
{
name: 'hideTitle',
type: 'boolean',
title: 'Hide title',
description: 'Hides title, but is available for screen readers and gives an meaningful heading for the list',
},
{
type: 'array',
name: 'group',
Expand Down
14 changes: 0 additions & 14 deletions web/components/src/TextWithIcon/Media.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions web/components/src/TextWithIcon/Text.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions web/components/src/TextWithIcon/TextWithIcon.tsx

This file was deleted.

18 changes: 0 additions & 18 deletions web/components/src/TextWithIcon/Title.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions web/components/src/TextWithIcon/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion web/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export * from './Teaser'
export * from './Eyebrow'
export * from './Backgrounds'
export * from './FigureCaption'
export * from './TextWithIcon'
export * from './Accordion'
export * from './Menu'
export * from './Heading'
Expand Down
51 changes: 51 additions & 0 deletions web/core/TextWithIcon/TextWithIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { HTMLAttributes, forwardRef } from 'react'
import envisTwMerge from '../../twMerge'
import { IconData } from '@equinor/eds-icons'
import { TransformableIcon } from '../../icons/TransformableIcon'
import { ImageWithAlt } from '../../types'
import Img from 'next/image'
import { urlFor } from '../../common/helpers'
import { PortableTextBlock } from '@portabletext/types'
import { Typography } from '@core/Typography'
import Blocks from '../../pageComponents/shared/portableText/Blocks'

export type TextWithIconProps = {
title?: string
content?: PortableTextBlock[]
iconData?: IconData
image?: ImageWithAlt
/** Icondata or imageUrl styling */
iconClassName?: string
} & HTMLAttributes<HTMLDivElement>

export const TextWithIcon = forwardRef<HTMLDivElement, TextWithIconProps>(
({ title, content, iconData, className = '', image, iconClassName = '', ...rest }, ref) => {
return (
<div ref={ref} className={envisTwMerge(`flex flex-col gap-2 items-center`, className)} {...rest}>
{iconData && <TransformableIcon iconData={iconData} className={iconClassName} />}
{image && image?.asset && (
<Img
src={urlFor(image).size(150, 150).auto('format').toString()}
width="150"
height="150"
alt={image?.isDecorative ? '' : image?.alt || ''}
role={image?.isDecorative ? 'presentation' : undefined}
className={envisTwMerge(
`size-[150px]
m-auto
self-center
`,
iconClassName,
)}
/>
)}
{title && (
<Typography as="h2" variant="h3">
{title}
</Typography>
)}
{content && <Blocks value={content} className="text-pretty text-center" />}
</div>
)
},
)
5 changes: 5 additions & 0 deletions web/lib/queries/common/pageContentFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ _type == "keyNumbers" =>{
_type == "textWithIconArray"=>{
"type": _type,
"id": _key,
title[]{
...,
${markDefs},
},
hideTitle,
"group": group[]{
"id": _key,
title,
Expand Down
197 changes: 0 additions & 197 deletions web/pageComponents/pageTemplates/MagazineIndexPage.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import TextBlock from '../../topicPages/TextBlock'
import FullWidthImage from '../../topicPages/FullWidthImage'
import FullWidthVideo from '../../topicPages/FullWidthVideo'
import Figure from '../../topicPages/Figure'
import TextWithIconArray from '../../topicPages/TextWithIconArray'
import PageQuote from '../../topicPages/PageQuote'
import AccordionBlock from '../../topicPages/Accordion/AccordionBlock'
import PromoTileArray from '../../../sections/PromoTiles/PromoTileArray'
Expand Down Expand Up @@ -64,6 +63,7 @@ import VideoPlayerCarousel from '@sections/VideoPlayerCarousel/VideoPlayerCarous
import ImageCarousel from '@sections/ImageCarousel/ImageCarousel'
import ImageForText from '@sections/ImageForText/ImageForText'
import { AnchorLinkList } from '@sections/AnchorLinkList'
import TextWithIconArray from '@sections/TextWithIconArray/TextWithIconArray'
import { StickyTextBlocks } from '@sections/StickyTextBlocks'

type DefaultComponent = {
Expand Down
Loading

0 comments on commit 972db3b

Please sign in to comment.