Skip to content

Commit

Permalink
Remove old iframe component #2204 (#2212)
Browse files Browse the repository at this point in the history
* πŸ”₯ Remove deprecated iframe #2204

* πŸ”₯ Remove iframe fields #2204

* πŸ”₯ Remove deprecated iframe from event page  #2204
  • Loading branch information
millianapia authored May 3, 2024
1 parent f03d46e commit b6547a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 44 deletions.
15 changes: 1 addition & 14 deletions sanityv3/schemas/documents/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { EdsIcon } from '../../icons'
import CompactBlockEditor from '../components/CompactBlockEditor'
import { i18n } from '../documentTranslation'
import { configureBlockContent, configureTitleBlockContent } from '../editors'
import basicIframe, { IFrame } from '../objects/basicIframe'
import type { EventDate } from '../objects/eventDate'
import type { RelatedLinksArray } from '../objects/relatedLinks'
import basicIframe from '../objects/basicIframe'

const titleContentType = configureTitleBlockContent()
const blockContentType = configureBlockContent()
Expand Down Expand Up @@ -125,19 +125,6 @@ export default {
type: 'array',
of: [blockContentType, basicIframe],
},
{
title: 'IFrame (Deprecated)',
name: 'iframe',
type: 'basicIframe',
validation: (Rule: Rule) =>
Rule.custom((value: IFrame) => {
if (!value) {
return true
} else return 'IFrame is deprecated. Please insert iframe inside the content field.'
}).warning(),

description: 'Iframe is deprecated on event page. You can insert iframe directly in to the content field above.',
},
{
title: 'Title',
name: 'promotedPeopleTitle',
Expand Down
11 changes: 0 additions & 11 deletions web/lib/queries/common/eventContentFields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ export const eventContentFields = /* groq */ `
},
},
},
"iframe": iframe{
title,
frameTitle,
url,
"cookiePolicy": coalesce(cookiePolicy, 'none'),
"designOptions": {
"aspectRatio": coalesce(aspectRatio, '16:9'),
height,
${background}
},
},
"promotedPeople": {
"title": promotedPeopleTitle[]{
...,
Expand Down
23 changes: 4 additions & 19 deletions web/pageComponents/pageTemplates/Event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { FormattedMessage } from 'react-intl'
import styled from 'styled-components'
import { getEventDates } from '../../common/helpers/dateUtilities'
import ContactList from '../shared/ContactList'
import BasicIFrame from '../shared/iframe/BasicIFrame'
import EventText from '../shared/portableText/EventText'
import IngressText from '../shared/portableText/IngressText'
import TitleText from '../shared/portableText/TitleText'
Expand Down Expand Up @@ -32,9 +31,9 @@ const HeaderInner = styled.div`
margin-left: auto;
margin-right: auto;
`
const ContentWrapper = styled.div<{ iframe?: boolean }>`
const ContentWrapper = styled.div`
margin: var(--space-3xLarge) 0 0 0;
padding: ${({ iframe }) => (iframe ? '0' : '0 0 var(--space-xLarge) 0')};
padding: 0 0 var(--space-xLarge) 0;
`

const LeadParagraph = styled.div`
Expand Down Expand Up @@ -109,19 +108,6 @@ const StyledPromotion = styled(Promotion)`
}
`

const StyledBasicIFrame = styled(BasicIFrame)`
--iframe-maxWidth: var(--topbar-innerMaxWidth);
--iframe-innerPadding: var(--space-3xLarge) 0;
--iframe-titleAlign: center;
@media (min-width: 450px) {
--iframe-titleAlign: left;
}
padding: 0 var(--layout-paddingHorizontal-small);
`

const StyledContactList = styled(ContactList)`
--contactList-titleAlign: center;
Expand All @@ -135,7 +121,7 @@ const StyledContactList = styled(ContactList)`

export default function Event({ data }: { data: EventSchema }): JSX.Element {
const { title } = data
const { location, ingress, content, iframe, promotedPeople, relatedLinks, contactList, eventDate } = data.content
const { location, ingress, content, promotedPeople, relatedLinks, contactList, eventDate } = data.content

const plainTitle = title ? toPlainText(title as PortableTextBlock[]) : ''
const { start, end } = getEventDates(eventDate)
Expand Down Expand Up @@ -176,7 +162,7 @@ export default function Event({ data }: { data: EventSchema }): JSX.Element {
</HeaderInner>
</Header>
{(ingress || content) && (
<ContentWrapper iframe={iframe && !!iframe.title}>
<ContentWrapper>
{ingress && (
<LeadParagraph>
<IngressText value={ingress}></IngressText>
Expand All @@ -189,7 +175,6 @@ export default function Event({ data }: { data: EventSchema }): JSX.Element {
)}
</ContentWrapper>
)}
{iframe && <StyledBasicIFrame data={iframe} />}
{promotedPeople?.people && promotedPeople?.people.length > 0 && (
<StyledPromotion
data={{
Expand Down

0 comments on commit b6547a2

Please sign in to comment.