Skip to content

Commit

Permalink
Merge branch 'padms/1534' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
padms committed Aug 16, 2023
2 parents d70c78b + 504b387 commit d36a097
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/PROD-all-studios-v3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
id: deploy
working-directory: ./sanityv3
run: |
pnpm deploy
pnpm run deploy
env:
SANITY_AUTH_TOKEN: ${{ secrets.SANITY_DEPLOY }}
- uses: act10ns/slack@v2
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
id: deploy
working-directory: ./sanityv3
run: |
pnpm deploy
pnpm run deploy
env:
SANITY_AUTH_TOKEN: ${{ secrets.SANITY_SECRET_DEPLOY }}
- uses: act10ns/slack@v2
Expand Down
20 changes: 11 additions & 9 deletions sanityv3/schemas/objects/iframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ import type { ColorSelectorValue } from '../components/ColorSelector'
import blocksToText from '../../helpers/blocksToText'
import { EdsIcon } from '../../icons'
import { configureBlockContent, configureTitleBlockContent } from '../editors'
import { title, frameTitle, description, cookiePolicy, aspectRatio, url, height } from './iframe/sharedIframeFields'
import {
title,
frameTitle,
description,
cookiePolicy,
aspectRatio,
url,
height,
action,
} from './iframe/sharedIframeFields'

const ingressContentType = configureBlockContent({
h1: false,
Expand Down Expand Up @@ -65,14 +74,7 @@ export default {
aspectRatio,
height,
description,
{
name: 'action',
title: 'Link/action',
description: 'You can add one separate link if you need. The link will show up at the bottom of the component.',
type: 'array',
of: [{ type: 'linkSelector', title: 'Link' }],
validation: (Rule: Rule) => Rule.max(1),
},
action,
{
title: 'Background',
description: 'Pick a colour for the background. Default is white.',
Expand Down
9 changes: 9 additions & 0 deletions sanityv3/schemas/objects/iframe/sharedIframeFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,12 @@ export const description = {
type: 'array',
of: [descriptionContentType],
}

export const action = {
name: 'action',
title: 'Link/action',
description: 'You can add one separate link if you need. The link will show up at the bottom of the component.',
type: 'array',
of: [{ type: 'linkSelector', title: 'Link' }],
validation: (Rule: Rule) => Rule.max(1),
}
13 changes: 11 additions & 2 deletions sanityv3/schemas/objects/iframeCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ import { EdsIcon } from '../../icons'
import { library_image } from '@equinor/eds-icons'
import blocksToText from '../../helpers/blocksToText'
import type { Rule } from 'sanity'
import { title, frameTitle, description, cookiePolicy, aspectRatio, url, height } from './iframe/sharedIframeFields'
import {
title,
frameTitle,
description,
cookiePolicy,
aspectRatio,
url,
height,
action,
} from './iframe/sharedIframeFields'

const carouselItemFields = [title, frameTitle, description, cookiePolicy, aspectRatio, url, height]
const carouselItemFields = [title, frameTitle, description, cookiePolicy, aspectRatio, url, height, action]
export default {
name: 'iframeCarousel',
title: 'Horizontal scroll iframe',
Expand Down
20 changes: 11 additions & 9 deletions studio/schemas/objects/iframe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ import CharCounterEditor from '../components/CharCounterEditor'
import blocksToText from '../../helpers/blocksToText'
import type { Rule, Block } from '@sanity/types'
import type { ColorListValue } from 'sanity-plugin-color-list'
import { title, frameTitle, description, cookiePolicy, aspectRatio, url, height } from './iframe/sharedIframeFields'
import {
title,
frameTitle,
description,
cookiePolicy,
aspectRatio,
url,
height,
action,
} from './iframe/sharedIframeFields'

const ingressContentType = configureBlockContent({
h1: false,
Expand Down Expand Up @@ -69,14 +78,7 @@ export default {
aspectRatio,
height,
description,
{
name: 'action',
title: 'Link/action',
description: 'You can add one separate link if you need. The link will show up at the bottom of the component.',
type: 'array',
of: [{ type: 'linkSelector', title: 'Link' }],
validation: (Rule: Rule) => Rule.max(1),
},
action,
{
title: 'Background',
description: 'Pick a colour for the background. Default is white.',
Expand Down
9 changes: 9 additions & 0 deletions studio/schemas/objects/iframe/sharedIframeFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,12 @@ export const description = {
inputComponent: CharCounterEditor,
of: [descriptionContentType],
}

export const action = {
name: 'action',
title: 'Link/action',
description: 'You can add one separate link if you need. The link will show up at the bottom of the component.',
type: 'array',
of: [{ type: 'linkSelector', title: 'Link' }],
validation: (Rule: Rule) => Rule.max(1),
}
13 changes: 11 additions & 2 deletions studio/schemas/objects/iframeCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ import { EdsIcon } from '../../icons'
import { library_image } from '@equinor/eds-icons'
import blocksToText from '../../helpers/blocksToText'
import type { Rule } from '@sanity/types'
import { title, frameTitle, description, cookiePolicy, aspectRatio, url, height } from './iframe/sharedIframeFields'
import {
title,
frameTitle,
description,
cookiePolicy,
aspectRatio,
url,
height,
action,
} from './iframe/sharedIframeFields'

const carouselItemFields = [title, frameTitle, description, cookiePolicy, aspectRatio, url, height]
const carouselItemFields = [title, frameTitle, description, cookiePolicy, aspectRatio, url, height, action]
export default {
name: 'iframeCarousel',
title: 'Horizontal scroll iframe',
Expand Down
6 changes: 5 additions & 1 deletion web/lib/queries/iframeCarouselFields.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import linkSelectorFields from './common/actions/linkSelectorFields'

export const iframeCarouselFields = /* groq */ `
"id": _key,
"type": _type,
title,
items,
items[]{..., "action": action[0]{
${linkSelectorFields},
},},
"designOptions": {
"background": coalesce(background.title, 'none'),
},
Expand Down
16 changes: 15 additions & 1 deletion web/pageComponents/shared/IframeCarousel/IframeCarousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'swiper/css/pagination'
import CoreIFrame from '../iframe/IFrame'
import RichText from '../portableText/RichText'
import { Carousel } from '../../shared/Carousel'
import { ButtonLink } from '../ButtonLink'

const Container = styled.div`
padding: var(--space-3xLarge) calc(var(--layout-paddingHorizontal-small) - var(--space-xxLarge));
Expand All @@ -25,8 +26,17 @@ const Figure = styled.figure`
width: 100%;
`
const ItemContainer = styled.div`
min-width: 100%;
width: 100%;
min-width: 90%;
@media (min-width: 1300px) {
min-width: 45%;
/* exactly two items */
:first-child:nth-last-child(2),
:last-child:nth-child(2) {
min-width: calc(50% - var(--space-medium));
}
}
`

const StyledHeading = styled(TitleText)`
Expand All @@ -43,6 +53,9 @@ const StyledItemHeading = styled(TitleText)`
display: -webkit-box;
-webkit-box-orient: vertical;
`
const StyledButtonLink = styled(ButtonLink)`
margin-top: var(--space-xLarge);
`

type IframeCarouselProps = {
data: IframeCarouselData
Expand Down Expand Up @@ -85,6 +98,7 @@ const IframeCarousel = ({ data, anchor, ...rest }: IframeCarouselProps) => {
hasSectionTitle={!!item.title}
/>
)}
{item.action && item.action.label && <StyledButtonLink action={item.action} />}
</ItemContainer>
))}
</Carousel>
Expand Down
2 changes: 1 addition & 1 deletion web/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ export type VideoPlayerCarouselData = {
title?: PortableTextBlock[]
}


export type LoopingVideoRatio = '1:2' | 'narrow'

export type LoopingVideoData = {
Expand Down Expand Up @@ -736,6 +735,7 @@ export type IFrameCarouselItemData = {
cookiePolicy: CookiePolicy
aspectRatio: string
height?: number
action?: LinkData
}

export type IframeCarouselData = {
Expand Down

0 comments on commit d36a097

Please sign in to comment.