From 081d9217100440b8005f2c3a92664135b107e5f1 Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Wed, 25 Oct 2023 15:14:15 +0530
Subject: [PATCH 01/14] =?UTF-8?q?=E2=9C=A8=20Add=20big=20title=20option=20?=
=?UTF-8?q?to=2050-50=20banner=20#1887?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../documents/header/sharedHeaderFields.ts | 45 ++++++++++++++++---
web/components/src/Heading/Heading.tsx | 2 +-
web/lib/queries/common/heroFields.ts | 3 +-
.../pageTemplates/shared/SharedBanner.tsx | 1 +
.../shared/Hero/FiftyFiftyHero.tsx | 9 ++--
web/types/types.ts | 1 +
6 files changed, 50 insertions(+), 11 deletions(-)
diff --git a/sanityv3/schemas/documents/header/sharedHeaderFields.ts b/sanityv3/schemas/documents/header/sharedHeaderFields.ts
index da9e87d18..190e2b304 100644
--- a/sanityv3/schemas/documents/header/sharedHeaderFields.ts
+++ b/sanityv3/schemas/documents/header/sharedHeaderFields.ts
@@ -1,9 +1,13 @@
-import { Rule, ValidationContext } from 'sanity'
+import { PortableTextBlock, Rule, ValidationContext } from 'sanity'
import CompactBlockEditor from '../../components/CompactBlockEditor'
import { configureBlockContent, configureTitleBlockContent } from '../../editors'
import { HeroTypes } from '../../HeroTypes'
-type DocumentType = { parent: { heroType?: string } }
+type DocumentType = { parent: Hero }
+type Hero = {
+ heroType?: string
+ isBigTitle?: boolean
+}
const titleContentType = configureTitleBlockContent()
const ingressContentType = configureBlockContent({
@@ -14,6 +18,29 @@ const ingressContentType = configureBlockContent({
attachment: false,
})
+const isBigTitle = {
+ title: 'Big title',
+ name: 'isBigTitle',
+ type: 'boolean',
+ fieldset: 'header',
+ hidden: ({ parent }: DocumentType) => {
+ return parent?.heroType !== HeroTypes.FIFTY_FIFTY
+ },
+}
+
+const heroBigTitle = {
+ name: 'heroBigTitle',
+ title: 'Big Title',
+ type: 'array',
+ fieldset: 'header',
+ of: [titleContentType],
+ hidden: ({ parent }: DocumentType) => !parent.isBigTitle,
+ validation: (Rule: Rule) =>
+ Rule.custom((value: PortableTextBlock[], ctx: ValidationContext) =>
+ !value && (ctx.parent as Hero)?.isBigTitle ? 'Title is required' : true,
+ ),
+}
+
const title = {
name: 'title',
type: 'array',
@@ -76,7 +103,9 @@ const heroTitle = {
of: [titleContentType],
fieldset: 'header',
hidden: ({ parent }: DocumentType) => {
- return parent?.heroType !== HeroTypes.FIFTY_FIFTY
+ return (
+ parent?.heroType !== HeroTypes.FIFTY_FIFTY || (parent?.heroType === HeroTypes.FIFTY_FIFTY && parent.isBigTitle)
+ )
},
validation: (Rule: Rule) =>
Rule.custom((value: string, context: ValidationContext) => {
@@ -92,7 +121,9 @@ const heroIngress = {
type: 'array',
of: [ingressContentType],
hidden: ({ parent }: DocumentType) => {
- return parent?.heroType !== HeroTypes.FIFTY_FIFTY
+ return (
+ parent?.heroType !== HeroTypes.FIFTY_FIFTY || (parent?.heroType === HeroTypes.FIFTY_FIFTY && parent.isBigTitle)
+ )
},
fieldset: 'header',
}
@@ -104,7 +135,9 @@ const heroLink = {
type: 'array',
of: [{ type: 'linkSelector', title: 'Link' }],
hidden: ({ parent }: DocumentType) => {
- return parent?.heroType !== HeroTypes.FIFTY_FIFTY
+ return (
+ parent?.heroType !== HeroTypes.FIFTY_FIFTY || (parent?.heroType === HeroTypes.FIFTY_FIFTY && parent.isBigTitle)
+ )
},
fieldset: 'header',
validation: (Rule: Rule) => Rule.max(1).error('Only one action is permitted'),
@@ -179,10 +212,12 @@ const heroLoopingVideoRatio = {
}
export default [
+ isBigTitle,
title,
heroType,
heroRatio,
heroTitle,
+ heroBigTitle,
heroIngress,
heroLink,
background,
diff --git a/web/components/src/Heading/Heading.tsx b/web/components/src/Heading/Heading.tsx
index bca5c415d..0d5fb7b88 100644
--- a/web/components/src/Heading/Heading.tsx
+++ b/web/components/src/Heading/Heading.tsx
@@ -65,7 +65,7 @@ const fontWeights = {
md: 'var(--fontWeight-regular)',
lg: 'var(--fontWeight-regular)',
xl: 'var(--fontWeight-regular)',
- '2xl': 'var(--fontWeidht-regular)',
+ '2xl': 'var(--fontWeight-regular)',
'3xl': 'var(--fontWeight-regular)',
}
diff --git a/web/lib/queries/common/heroFields.ts b/web/lib/queries/common/heroFields.ts
index d45e7b81d..3c71a84f6 100644
--- a/web/lib/queries/common/heroFields.ts
+++ b/web/lib/queries/common/heroFields.ts
@@ -3,7 +3,8 @@ import linkSelectorFields from './actions/linkSelectorFields'
export const heroFields = /* groq */ `{
"type": coalesce(heroType, 'default'),
"ratio": heroRatio,
- "title": heroTitle,
+ "isBigTitle":isBigTitle,
+ "title": select(isBigTitle => heroBigTitle , heroTitle),
"ingress": heroIngress,
"background": coalesce(heroBackground.title, 'White'),
"figure": select(
diff --git a/web/pageComponents/pageTemplates/shared/SharedBanner.tsx b/web/pageComponents/pageTemplates/shared/SharedBanner.tsx
index 313c0f28e..3a096169c 100644
--- a/web/pageComponents/pageTemplates/shared/SharedBanner.tsx
+++ b/web/pageComponents/pageTemplates/shared/SharedBanner.tsx
@@ -32,6 +32,7 @@ export const SharedBanner = ({ title, hero, hideImageCaption, captionBg }: Banne
link={hero.link}
ingress={hero.ingress}
background={hero.background}
+ isBigTitle={hero.isBigTitle}
/>
)
case HeroTypes.LOOPING_VIDEO:
diff --git a/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx b/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
index 05ee3a89d..a190bcb62 100644
--- a/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
+++ b/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
@@ -80,7 +80,7 @@ const HeroActionLink = ({ action, ...rest }: { action: LinkData }) => {
)
}
-export const FiftyFiftyHero = ({ title, ingress, link, background, figure }: HeroType) => {
+export const FiftyFiftyHero = ({ title, ingress, link, background, figure, isBigTitle }: HeroType) => {
return (
<>
@@ -97,8 +97,9 @@ export const FiftyFiftyHero = ({ title, ingress, link, background, figure }: Her
)}
- {title && }
- {ingress && (
+ {isBigTitle}
+ {title && }
+ {ingress && !isBigTitle && (
)}
- {link && }
+ {link && !isBigTitle && }
>
diff --git a/web/types/types.ts b/web/types/types.ts
index 1ad4bc52b..db1901831 100644
--- a/web/types/types.ts
+++ b/web/types/types.ts
@@ -179,6 +179,7 @@ export enum HeroTypes {
export type HeroType = {
figure?: ImageWithCaptionData
+ isBigTitle?: boolean
title?: PortableTextBlock[]
ingress?: PortableTextBlock[]
link?: LinkData
From 45c6332ab211e5fcdaf55eb86caba99a40a1afe8 Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Thu, 26 Oct 2023 19:59:20 +0530
Subject: [PATCH 02/14] =?UTF-8?q?=E2=9C=A8=20Big=20title=20option=20for=20?=
=?UTF-8?q?default=20banner=20#1886?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../documents/header/sharedHeaderFields.ts | 52 ++++++++++++---
.../editors/titleEditorContentType.tsx | 63 +++++++++++++++++--
web/components/src/Heading/Heading.tsx | 13 +++-
web/lib/queries/common/heroFields.ts | 2 +-
.../pageTemplates/shared/SharedBanner.tsx | 2 +-
.../shared/Hero/DefaultHero.tsx | 24 ++++++-
.../shared/Hero/FiftyFiftyHero.tsx | 2 -
.../shared/portableText/TitleText.tsx | 10 ++-
.../portableText/components/Highlight.tsx | 3 +
.../shared/portableText/components/index.ts | 1 +
web/styles/settings.ts | 2 +
11 files changed, 152 insertions(+), 22 deletions(-)
create mode 100644 web/pageComponents/shared/portableText/components/Highlight.tsx
diff --git a/sanityv3/schemas/documents/header/sharedHeaderFields.ts b/sanityv3/schemas/documents/header/sharedHeaderFields.ts
index 190e2b304..4eaa94c77 100644
--- a/sanityv3/schemas/documents/header/sharedHeaderFields.ts
+++ b/sanityv3/schemas/documents/header/sharedHeaderFields.ts
@@ -1,8 +1,11 @@
import { PortableTextBlock, Rule, ValidationContext } from 'sanity'
+import blocksToText from '../../../helpers/blocksToText'
import CompactBlockEditor from '../../components/CompactBlockEditor'
import { configureBlockContent, configureTitleBlockContent } from '../../editors'
import { HeroTypes } from '../../HeroTypes'
+const bigTitleRoles = ['administrator', 'developer', 'editor'] // allow editor until designer role is created.
+
type DocumentType = { parent: Hero }
type Hero = {
heroType?: string
@@ -10,6 +13,10 @@ type Hero = {
}
const titleContentType = configureTitleBlockContent()
+const bigTitleContentType = configureTitleBlockContent({
+ extraLarge: true,
+ highlight: true,
+})
const ingressContentType = configureBlockContent({
h1: false,
h2: false,
@@ -24,21 +31,49 @@ const isBigTitle = {
type: 'boolean',
fieldset: 'header',
hidden: ({ parent }: DocumentType) => {
- return parent?.heroType !== HeroTypes.FIFTY_FIFTY
+ return !(parent?.heroType === HeroTypes.FIFTY_FIFTY || parent?.heroType === HeroTypes.DEFAULT)
+ },
+ readOnly: ({ currentUser }: any) => {
+ return !currentUser.roles.find(({ name }: any) => bigTitleRoles.includes(name))
},
}
-const heroBigTitle = {
- name: 'heroBigTitle',
- title: 'Big Title',
+const heroBigTitleDefault = {
+ name: 'heroBigTitleDefault',
+ title: 'Hero Title',
type: 'array',
fieldset: 'header',
- of: [titleContentType],
- hidden: ({ parent }: DocumentType) => !parent.isBigTitle,
+ of: [bigTitleContentType],
+ hidden: ({ parent }: DocumentType) => !parent.isBigTitle || parent.heroType !== HeroTypes.DEFAULT,
+ validation: (Rule: Rule) =>
+ Rule.custom((value: PortableTextBlock[], ctx: ValidationContext) =>
+ blocksToText(value)?.length === 0 &&
+ (ctx.parent as Hero)?.isBigTitle &&
+ (ctx.parent as Hero)?.heroType === HeroTypes.DEFAULT
+ ? 'Title is required'
+ : true,
+ ),
+ readOnly: ({ currentUser }: any) => {
+ return !currentUser.roles.find(({ name }: any) => bigTitleRoles.includes(name))
+ },
+}
+
+const heroBigTitleFiftyFifty = {
+ name: 'heroBigTitleFiftyFifty',
+ title: 'Hero Title',
+ type: 'array',
+ fieldset: 'header',
+ of: [configureTitleBlockContent({ isBigTitle: true })],
+ hidden: ({ parent }: DocumentType) => !parent.isBigTitle || parent.heroType !== HeroTypes.FIFTY_FIFTY,
validation: (Rule: Rule) =>
Rule.custom((value: PortableTextBlock[], ctx: ValidationContext) =>
- !value && (ctx.parent as Hero)?.isBigTitle ? 'Title is required' : true,
+ !value && (ctx.parent as Hero)?.isBigTitle && (ctx.parent as Hero)?.heroType === HeroTypes.FIFTY_FIFTY
+ ? 'Title is required'
+ : true,
),
+ readOnly: ({ currentUser }: any) => {
+ return !currentUser.roles.find(({ name }: any) => bigTitleRoles.includes(name))
+ },
}
const title = {
@@ -217,7 +252,8 @@ export default [
heroType,
heroRatio,
heroTitle,
- heroBigTitle,
+ heroBigTitleDefault,
+ heroBigTitleFiftyFifty,
heroIngress,
heroLink,
background,
diff --git a/sanityv3/schemas/editors/titleEditorContentType.tsx b/sanityv3/schemas/editors/titleEditorContentType.tsx
index c3989715b..c3b3c0aae 100644
--- a/sanityv3/schemas/editors/titleEditorContentType.tsx
+++ b/sanityv3/schemas/editors/titleEditorContentType.tsx
@@ -1,14 +1,43 @@
import { SuperScriptRenderer, SubScriptRenderer, StrikeThroughRenderer } from '../components'
-import { IconSuperScript, IconSubScript } from '../../icons'
+import { IconSuperScript, IconSubScript, EdsBlockEditorIcon } from '../../icons'
import { StrikethroughIcon } from '@sanity/icons'
import type { BlockFieldType } from '../../types/schemaTypes'
+import { format_color_text } from '@equinor/eds-icons'
+
+export type TitleContentProps = {
+ highlight?: boolean
+ extraLarge?: boolean
+ isBigTitle?: boolean
+ large?: {
+ title: string
+ value: 'normal'
+ component?: ({ children }: { children: React.ReactNode }) => JSX.Element
+ }
+}
// TODO: Add relevant styles for titles (i.e. highlighted text)
-export const configureTitleBlockContent = (): BlockFieldType => {
- // const { strong, emphasis, strikethrough } = options
- return {
+export const configureTitleBlockContent = (options: TitleContentProps = {}): BlockFieldType => {
+ const {
+ large = {
+ title: 'Large',
+ value: 'normal',
+ },
+ extraLarge = false,
+ highlight = false,
+ isBigTitle = false,
+ } = options
+
+ const largeTitleText = {
+ title: 'Large',
+ value: 'normal',
+ component: ({ children }: { children: React.ReactNode }) => {children},
+ }
+
+ const titleStyle = extraLarge || isBigTitle ? largeTitleText : large
+
+ const config: BlockFieldType = {
type: 'block',
- styles: [],
+ styles: [titleStyle],
lists: [],
marks: {
decorators: [
@@ -36,6 +65,30 @@ export const configureTitleBlockContent = (): BlockFieldType => {
annotations: [],
},
}
+ const extraLargeConfig = {
+ title: 'Extra Large',
+ value: 'extraLarge',
+ component: ({ children }: { children: React.ReactNode }) => {children},
+ }
+
+ const HighlightTextRender = (props: any) => {
+ const { children } = props
+ return {children}
+ }
+
+ const textColorConfig = {
+ title: 'HighLight',
+ value: 'highlight',
+ icon: EdsBlockEditorIcon(format_color_text),
+ component: HighlightTextRender,
+ }
+ if (extraLarge) {
+ config.styles.push(extraLargeConfig)
+ }
+ if (highlight) {
+ config.marks.decorators.push(textColorConfig)
+ }
+ return config
}
export default configureTitleBlockContent()
diff --git a/web/components/src/Heading/Heading.tsx b/web/components/src/Heading/Heading.tsx
index 0d5fb7b88..1dda527fb 100644
--- a/web/components/src/Heading/Heading.tsx
+++ b/web/components/src/Heading/Heading.tsx
@@ -27,10 +27,15 @@ const StyledHeading = styled(Typography)`
.inverted-background & {
color: var(--inverted-text);
}
+
+ strong,
+ b {
+ font-weight: var(--fontWeight-medium);
+ }
`
export type HeadingProps = {
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl'
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl'
level?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
regular?: boolean
center?: boolean
@@ -47,6 +52,8 @@ const sizes = {
xl: 'var(--typeScale-4)',
'2xl': 'var(--typeScale-4_5)',
'3xl': 'var(--typeScale-5)',
+ '4xl': 'var(--typeScale-6)',
+ '5xl': 'var(--typeScale-7)',
}
const lineHeights = {
@@ -57,6 +64,8 @@ const lineHeights = {
xl: 'var(--lineHeight-1)',
'2xl': 'var(--lineHeight-2_5)',
'3xl': 'var(--lineHeight-2)',
+ '4xl': 'var(--lineHeight-2)',
+ '5xl': 'var(--lineHeight-2)',
}
const fontWeights = {
@@ -67,6 +76,8 @@ const fontWeights = {
xl: 'var(--fontWeight-regular)',
'2xl': 'var(--fontWeight-regular)',
'3xl': 'var(--fontWeight-regular)',
+ '4xl': 'var(--fontWeight-regular)',
+ '5xl': 'var(--fontWeight-regular)',
}
export const Heading = forwardRef(function Heading(
diff --git a/web/lib/queries/common/heroFields.ts b/web/lib/queries/common/heroFields.ts
index 3c71a84f6..507b94641 100644
--- a/web/lib/queries/common/heroFields.ts
+++ b/web/lib/queries/common/heroFields.ts
@@ -4,7 +4,7 @@ export const heroFields = /* groq */ `{
"type": coalesce(heroType, 'default'),
"ratio": heroRatio,
"isBigTitle":isBigTitle,
- "title": select(isBigTitle => heroBigTitle , heroTitle),
+ "title": select(isBigTitle => select( heroType == 'fiftyFifty' => heroBigTitleFiftyFifty, heroBigTitleDefault) , heroTitle),
"ingress": heroIngress,
"background": coalesce(heroBackground.title, 'White'),
"figure": select(
diff --git a/web/pageComponents/pageTemplates/shared/SharedBanner.tsx b/web/pageComponents/pageTemplates/shared/SharedBanner.tsx
index 3a096169c..f3ba330c8 100644
--- a/web/pageComponents/pageTemplates/shared/SharedBanner.tsx
+++ b/web/pageComponents/pageTemplates/shared/SharedBanner.tsx
@@ -38,6 +38,6 @@ export const SharedBanner = ({ title, hero, hideImageCaption, captionBg }: Banne
case HeroTypes.LOOPING_VIDEO:
return
default:
- return
+ return
}
}
diff --git a/web/pageComponents/shared/Hero/DefaultHero.tsx b/web/pageComponents/shared/Hero/DefaultHero.tsx
index 61fcdb6dd..8b43aa4e7 100644
--- a/web/pageComponents/shared/Hero/DefaultHero.tsx
+++ b/web/pageComponents/shared/Hero/DefaultHero.tsx
@@ -10,6 +10,18 @@ const StyledHeading = styled(TitleText)`
margin-right: auto;
`
+const HeroBannerSmall = styled.div`
+ margin-left: auto;
+ margin-right: auto;
+ max-width: 1920px;
+ padding: var(--space-xLarge) var(--space-3xLarge) 0 var(--layout-paddingHorizontal-small);
+`
+const HeroBannerBigTitle = styled.div`
+ margin-left: auto;
+ margin-right: auto;
+ max-width: 1920px;
+ padding: var(--space-xLarge) var(--layout-paddingHorizontal-small);
+`
const HeroBanner = styled.div`
padding: var(--space-xLarge) var(--layout-paddingHorizontal-medium);
`
@@ -29,12 +41,20 @@ const ImageWrapper = styled.div.attrs(() => ({
type Props = {
title?: PortableTextBlock[]
image?: ImageWithCaptionData
+ isBigTitle?: boolean
+ bigTitle?: PortableTextBlock[]
}
-export const DefaultHero = ({ title, image }: Props) => {
+export const DefaultHero = ({ title, image, isBigTitle, bigTitle }: Props) => {
return (
<>
- {title && }
+ {isBigTitle && (
+ <>
+ {title && }
+ {bigTitle && }
+ >
+ )}
+ {!isBigTitle && {title && }}
{image && }
>
)
diff --git a/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx b/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
index a190bcb62..e122868f5 100644
--- a/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
+++ b/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
@@ -55,7 +55,6 @@ const StyledIngress = styled.div`
`
const StyledHeroTitle = styled(TitleText)`
max-width: 1186px; /* 1920 - (2 * 367) */
- font-weight: var(--fontWeight-medium);
`
const HeroActionLink = ({ action, ...rest }: { action: LinkData }) => {
@@ -97,7 +96,6 @@ export const FiftyFiftyHero = ({ title, ingress, link, background, figure, isBig
)}
- {isBigTitle}
{title && }
{ingress && !isBigTitle && (
diff --git a/web/pageComponents/shared/portableText/TitleText.tsx b/web/pageComponents/shared/portableText/TitleText.tsx
index fd33f4aab..979f650b2 100644
--- a/web/pageComponents/shared/portableText/TitleText.tsx
+++ b/web/pageComponents/shared/portableText/TitleText.tsx
@@ -1,7 +1,7 @@
import { PortableText, PortableTextProps } from '@portabletext/react'
import { Heading, HeadingProps } from '@components'
import isEmpty from './helpers/isEmpty'
-import { Sub, Sup, Strikethrough } from './components'
+import { Sub, Sup, Strikethrough, Highlight } from './components'
import type { PortableTextBlock } from '@portabletext/types'
@@ -22,8 +22,14 @@ const defaultComponents = ({ size, level, className }: DefaultComponents) => {
)
},
+
+ extraLarge: ({ children }: PortableTextBlock) => (
+
+ <>{children}>
+
+ ),
},
- marks: { sub: Sub, sup: Sup, s: Strikethrough },
+ marks: { sub: Sub, sup: Sup, s: Strikethrough, highlight: Highlight },
}
}
diff --git a/web/pageComponents/shared/portableText/components/Highlight.tsx b/web/pageComponents/shared/portableText/components/Highlight.tsx
new file mode 100644
index 000000000..b9135c983
--- /dev/null
+++ b/web/pageComponents/shared/portableText/components/Highlight.tsx
@@ -0,0 +1,3 @@
+export const Highlight = ({ children }: { children?: React.ReactNode }) => {
+ return {children}
+}
diff --git a/web/pageComponents/shared/portableText/components/index.ts b/web/pageComponents/shared/portableText/components/index.ts
index 65035b841..7a54c4f71 100644
--- a/web/pageComponents/shared/portableText/components/index.ts
+++ b/web/pageComponents/shared/portableText/components/index.ts
@@ -8,6 +8,7 @@ export * from './InternalLink'
export * from './BulletList'
export * from './NumberedList'
export * from './BasicIframe'
+export * from './Highlight'
export * from './news/Fact'
export * from './news/FigureWithLayout'
diff --git a/web/styles/settings.ts b/web/styles/settings.ts
index 8fcc1f1a0..815b85217 100644
--- a/web/styles/settings.ts
+++ b/web/styles/settings.ts
@@ -100,6 +100,8 @@ export const typography = css`
--typeScale-4: clamp(calc(27.65 / 16 * 1rem), 0.99vw + 1.5rem, calc(42.97 / 16 * 1rem));
--typeScale-4_5: clamp(calc(33.73 / 16 * 1rem), 1.38vw + 1.785rem, calc(55.055 / 16 * 1rem));
--typeScale-5: clamp(calc(39.81 / 16 * 1rem), 1.77vw + 2.07rem, calc(67.14 / 16 * 1rem));
+ --typeScale-6: clamp(calc(45.89 / 16 * 1rem), 2.16vw + 2.355rem, calc(79.225 / 16 * 1rem));
+ --typeScale-7: clamp(calc(51.97 / 16 * 1rem), 2.55vw + 2.64rem, calc(91.31 / 16 * 1rem));
// search and replace, then remove
--typeScale-small: var(--typeScale-00);
From 6baab8094b82a5e74d4b3780f5205c1ffaf029be Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Thu, 2 Nov 2023 20:54:05 +0530
Subject: [PATCH 03/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Move=20big=20title?=
=?UTF-8?q?=20logic=20to=20seperate=20file=20#1887?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../documents/header/bigTitleStyles.tsx | 22 +++++++++++
.../documents/header/sharedHeaderFields.ts | 32 ++++++++--------
.../editors/titleEditorContentType.tsx | 37 ++++++-------------
sanityv3/types/schemaTypes.d.ts | 7 +++-
4 files changed, 56 insertions(+), 42 deletions(-)
create mode 100644 sanityv3/schemas/documents/header/bigTitleStyles.tsx
diff --git a/sanityv3/schemas/documents/header/bigTitleStyles.tsx b/sanityv3/schemas/documents/header/bigTitleStyles.tsx
new file mode 100644
index 000000000..2cf210444
--- /dev/null
+++ b/sanityv3/schemas/documents/header/bigTitleStyles.tsx
@@ -0,0 +1,22 @@
+import { BlockFieldStyle } from '../../../types/schemaTypes'
+
+const bigTitle = {
+ title: 'Large',
+ value: 'normal',
+ component: ({ children }: { children: React.ReactNode }) => {
+ return {children}
+ },
+}
+
+export const defaultBannerBigTitletStyle: BlockFieldStyle[] = [
+ bigTitle,
+ {
+ title: 'Extra Large',
+ value: 'extraLarge',
+ component: ({ children }: { children: React.ReactNode }) => {
+ return {children}
+ },
+ },
+]
+
+export const fiftyFiftyBigTitleStyle: BlockFieldStyle[] = [bigTitle]
diff --git a/sanityv3/schemas/documents/header/sharedHeaderFields.ts b/sanityv3/schemas/documents/header/sharedHeaderFields.ts
index 4eaa94c77..f721d1cd5 100644
--- a/sanityv3/schemas/documents/header/sharedHeaderFields.ts
+++ b/sanityv3/schemas/documents/header/sharedHeaderFields.ts
@@ -1,22 +1,19 @@
-import { PortableTextBlock, Rule, ValidationContext } from 'sanity'
+import { PortableTextBlock, Rule, ValidationContext, CurrentUser } from 'sanity'
import blocksToText from '../../../helpers/blocksToText'
import CompactBlockEditor from '../../components/CompactBlockEditor'
import { configureBlockContent, configureTitleBlockContent } from '../../editors'
import { HeroTypes } from '../../HeroTypes'
+import { defaultBannerBigTitletStyle, fiftyFiftyBigTitleStyle } from './bigTitleStyles'
const bigTitleRoles = ['administrator', 'developer', 'editor'] // allow editor until designer role is created.
-type DocumentType = { parent: Hero }
+type DocumentType = { parent: Hero; currentUser: CurrentUser }
type Hero = {
heroType?: string
isBigTitle?: boolean
}
const titleContentType = configureTitleBlockContent()
-const bigTitleContentType = configureTitleBlockContent({
- extraLarge: true,
- highlight: true,
-})
const ingressContentType = configureBlockContent({
h1: false,
h2: false,
@@ -33,7 +30,7 @@ const isBigTitle = {
hidden: ({ parent }: DocumentType) => {
return !(parent?.heroType === HeroTypes.FIFTY_FIFTY || parent?.heroType === HeroTypes.DEFAULT)
},
- readOnly: ({ currentUser }: any) => {
+ readOnly: ({ currentUser }: DocumentType) => {
return !currentUser.roles.find(({ name }: any) => bigTitleRoles.includes(name))
},
}
@@ -43,7 +40,12 @@ const heroBigTitleDefault = {
title: 'Hero Title',
type: 'array',
fieldset: 'header',
- of: [bigTitleContentType],
+ of: [
+ configureTitleBlockContent({
+ highlight: true,
+ styles: defaultBannerBigTitletStyle,
+ }),
+ ],
hidden: ({ parent }: DocumentType) => !parent.isBigTitle || parent.heroType !== HeroTypes.DEFAULT,
validation: (Rule: Rule) =>
Rule.custom((value: PortableTextBlock[], ctx: ValidationContext) =>
@@ -53,7 +55,7 @@ const heroBigTitleDefault = {
? 'Title is required'
: true,
),
- readOnly: ({ currentUser }: any) => {
+ readOnly: ({ currentUser }: DocumentType) => {
return !currentUser.roles.find(({ name }: any) => bigTitleRoles.includes(name))
},
}
@@ -63,7 +65,7 @@ const heroBigTitleFiftyFifty = {
title: 'Hero Title',
type: 'array',
fieldset: 'header',
- of: [configureTitleBlockContent({ isBigTitle: true })],
+ of: [configureTitleBlockContent({ styles: fiftyFiftyBigTitleStyle })],
hidden: ({ parent }: DocumentType) => !parent.isBigTitle || parent.heroType !== HeroTypes.FIFTY_FIFTY,
validation: (Rule: Rule) =>
Rule.custom((value: PortableTextBlock[], ctx: ValidationContext) =>
@@ -120,7 +122,7 @@ const heroRatio = {
},
validation: (Rule: Rule) =>
Rule.custom((value: string, context: ValidationContext) => {
- const { parent } = context as DocumentType
+ const { parent } = context as unknown as DocumentType
if (parent?.heroType === HeroTypes.FULL_WIDTH_IMAGE && !value) return 'Field is required'
return true
}),
@@ -144,7 +146,7 @@ const heroTitle = {
},
validation: (Rule: Rule) =>
Rule.custom((value: string, context: ValidationContext) => {
- const { parent } = context as DocumentType
+ const { parent } = context as unknown as DocumentType
if (parent?.heroType === HeroTypes.FIFTY_FIFTY && !value) return 'Field is required'
return true
}),
@@ -196,7 +198,7 @@ const heroImage = {
description: 'Caption and credit is not shown for 50-50 banner.',
validation: (Rule: Rule) =>
Rule.custom((value: string, context: ValidationContext) => {
- const { parent } = context as DocumentType
+ const { parent } = context as unknown as DocumentType
if (parent?.heroType === HeroTypes.LOOPING_VIDEO && !value) return 'Field is required'
return true
}),
@@ -214,7 +216,7 @@ const heroLoopingVideo = {
fieldset: 'header',
validation: (Rule: Rule) =>
Rule.custom((value: string, context: ValidationContext) => {
- const { parent } = context as DocumentType
+ const { parent } = context as unknown as DocumentType
if (parent?.heroType === HeroTypes.LOOPING_VIDEO && !value) return 'Field is required'
return true
}),
@@ -239,7 +241,7 @@ const heroLoopingVideoRatio = {
},
validation: (Rule: Rule) =>
Rule.custom((value: string, context: ValidationContext) => {
- const { parent } = context as DocumentType
+ const { parent } = context as unknown as DocumentType
if (parent?.heroType === HeroTypes.LOOPING_VIDEO && !value) return 'Field is required'
return true
}),
diff --git a/sanityv3/schemas/editors/titleEditorContentType.tsx b/sanityv3/schemas/editors/titleEditorContentType.tsx
index c3b3c0aae..391b8405a 100644
--- a/sanityv3/schemas/editors/titleEditorContentType.tsx
+++ b/sanityv3/schemas/editors/titleEditorContentType.tsx
@@ -1,10 +1,15 @@
import { SuperScriptRenderer, SubScriptRenderer, StrikeThroughRenderer } from '../components'
import { IconSuperScript, IconSubScript, EdsBlockEditorIcon } from '../../icons'
import { StrikethroughIcon } from '@sanity/icons'
-import type { BlockFieldType } from '../../types/schemaTypes'
+import type { BlockFieldStyle, BlockFieldType } from '../../types/schemaTypes'
import { format_color_text } from '@equinor/eds-icons'
export type TitleContentProps = {
+ styles?: BlockFieldStyle[]
+ highlight?: boolean
+}
+
+/*export type TitleContentProps = {
highlight?: boolean
extraLarge?: boolean
isBigTitle?: boolean
@@ -13,31 +18,19 @@ export type TitleContentProps = {
value: 'normal'
component?: ({ children }: { children: React.ReactNode }) => JSX.Element
}
-}
+}*/
// TODO: Add relevant styles for titles (i.e. highlighted text)
export const configureTitleBlockContent = (options: TitleContentProps = {}): BlockFieldType => {
- const {
- large = {
- title: 'Large',
- value: 'normal',
- },
- extraLarge = false,
- highlight = false,
- isBigTitle = false,
- } = options
-
- const largeTitleText = {
- title: 'Large',
+ const { highlight = false, styles } = options
+ const defaultStyle = {
+ title: 'Normal',
value: 'normal',
- component: ({ children }: { children: React.ReactNode }) => {children},
}
- const titleStyle = extraLarge || isBigTitle ? largeTitleText : large
-
const config: BlockFieldType = {
type: 'block',
- styles: [titleStyle],
+ styles: styles ? styles : [defaultStyle],
lists: [],
marks: {
decorators: [
@@ -65,11 +58,6 @@ export const configureTitleBlockContent = (options: TitleContentProps = {}): Blo
annotations: [],
},
}
- const extraLargeConfig = {
- title: 'Extra Large',
- value: 'extraLarge',
- component: ({ children }: { children: React.ReactNode }) => {children},
- }
const HighlightTextRender = (props: any) => {
const { children } = props
@@ -82,9 +70,6 @@ export const configureTitleBlockContent = (options: TitleContentProps = {}): Blo
icon: EdsBlockEditorIcon(format_color_text),
component: HighlightTextRender,
}
- if (extraLarge) {
- config.styles.push(extraLargeConfig)
- }
if (highlight) {
config.marks.decorators.push(textColorConfig)
}
diff --git a/sanityv3/types/schemaTypes.d.ts b/sanityv3/types/schemaTypes.d.ts
index d2969f9e6..e693215d5 100644
--- a/sanityv3/types/schemaTypes.d.ts
+++ b/sanityv3/types/schemaTypes.d.ts
@@ -29,9 +29,14 @@ export interface ReferenceFilter {
params: { [x: string]: any }
}
+export type BlockFieldStyle = {
+ title: string
+ value: string
+ component?: ({ children }: { children: React.ReactNode }) => JSX.Element
+}
export type BlockFieldType = {
type: string
- styles: { title: string; value: string }[]
+ styles: BlockFieldStyle[]
lists: { title: string; value: string }[] | []
marks: {
decorators: any[]
From 910d8c04837ab9f43deffb460975cdfd2e27711d Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Thu, 2 Nov 2023 21:15:57 +0530
Subject: [PATCH 04/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Use=20sanity=20types?=
=?UTF-8?q?=20for=20Block=20#1887?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../documents/header/bigTitleStyles.tsx | 6 ++---
sanityv3/schemas/editors/blockContentType.tsx | 24 +++++++++----------
.../editors/titleEditorContentType.tsx | 22 +++++------------
sanityv3/types/schemaTypes.d.ts | 15 ------------
4 files changed, 21 insertions(+), 46 deletions(-)
diff --git a/sanityv3/schemas/documents/header/bigTitleStyles.tsx b/sanityv3/schemas/documents/header/bigTitleStyles.tsx
index 2cf210444..fc922177b 100644
--- a/sanityv3/schemas/documents/header/bigTitleStyles.tsx
+++ b/sanityv3/schemas/documents/header/bigTitleStyles.tsx
@@ -1,4 +1,4 @@
-import { BlockFieldStyle } from '../../../types/schemaTypes'
+import { BlockStyleDefinition } from 'sanity'
const bigTitle = {
title: 'Large',
@@ -8,7 +8,7 @@ const bigTitle = {
},
}
-export const defaultBannerBigTitletStyle: BlockFieldStyle[] = [
+export const defaultBannerBigTitletStyle: BlockStyleDefinition[] = [
bigTitle,
{
title: 'Extra Large',
@@ -19,4 +19,4 @@ export const defaultBannerBigTitletStyle: BlockFieldStyle[] = [
},
]
-export const fiftyFiftyBigTitleStyle: BlockFieldStyle[] = [bigTitle]
+export const fiftyFiftyBigTitleStyle: BlockStyleDefinition[] = [bigTitle]
diff --git a/sanityv3/schemas/editors/blockContentType.tsx b/sanityv3/schemas/editors/blockContentType.tsx
index 377a7e20a..b7dc86bd2 100644
--- a/sanityv3/schemas/editors/blockContentType.tsx
+++ b/sanityv3/schemas/editors/blockContentType.tsx
@@ -1,9 +1,8 @@
import { attach_file, external_link, link } from '@equinor/eds-icons'
-import type { Rule, ValidationContext } from 'sanity'
+import type { BlockDefinition, Rule, ValidationContext } from 'sanity'
import { filterByPages, filterByPagesInOtherLanguages } from '../../helpers/referenceFilters'
import { EdsBlockEditorIcon, EdsIcon, IconSubScript, IconSuperScript } from '../../icons'
import { Flags } from '../../src/lib/datasetHelpers'
-import type { BlockFieldType } from '../../types/schemaTypes'
import { ExternalLinkRenderer, SubScriptRenderer, SuperScriptRenderer } from '../components'
import routes from '../routes'
@@ -28,7 +27,7 @@ const SmallTextRender = (props: any) => {
return {children}
}
-export const configureBlockContent = (options: BlockContentProps = {}): BlockFieldType => {
+export const configureBlockContent = (options: BlockContentProps = {}): BlockDefinition => {
const {
h1 = false,
h2 = true,
@@ -42,8 +41,9 @@ export const configureBlockContent = (options: BlockContentProps = {}): BlockFie
normalTextOverride = { title: 'Normal', value: 'normal' },
} = options
- const config: BlockFieldType = {
+ const config: BlockDefinition = {
type: 'block',
+ name: 'block',
styles: [normalTextOverride],
lists: lists
? [
@@ -208,34 +208,34 @@ export const configureBlockContent = (options: BlockContentProps = {}): BlockFie
}
if (h1) {
- config.styles.push(h1Config)
+ config?.styles?.push(h1Config)
}
if (h2) {
- config.styles.push(h2Config)
+ config?.styles?.push(h2Config)
}
if (h3) {
- config.styles.push(h3Config)
+ config?.styles?.push(h3Config)
}
if (h4) {
- config.styles.push(h4Config)
+ config?.styles?.push(h4Config)
}
if (smallText) {
- config.styles.push(smallTextConfig)
+ config?.styles?.push(smallTextConfig)
}
if (externalLink) {
- config.marks.annotations.push(externalLinkConfig)
+ config?.marks?.annotations?.push(externalLinkConfig)
}
if (internalLink) {
- config.marks.annotations.push(internalLinkConfig)
+ config?.marks?.annotations?.push(internalLinkConfig)
}
if (attachment) {
- config.marks.annotations.push(attachmentConfig)
+ config?.marks?.annotations?.push(attachmentConfig)
}
return config
diff --git a/sanityv3/schemas/editors/titleEditorContentType.tsx b/sanityv3/schemas/editors/titleEditorContentType.tsx
index 391b8405a..16f92434e 100644
--- a/sanityv3/schemas/editors/titleEditorContentType.tsx
+++ b/sanityv3/schemas/editors/titleEditorContentType.tsx
@@ -1,35 +1,25 @@
import { SuperScriptRenderer, SubScriptRenderer, StrikeThroughRenderer } from '../components'
import { IconSuperScript, IconSubScript, EdsBlockEditorIcon } from '../../icons'
import { StrikethroughIcon } from '@sanity/icons'
-import type { BlockFieldStyle, BlockFieldType } from '../../types/schemaTypes'
+import { BlockDefinition, BlockStyleDefinition } from 'sanity'
import { format_color_text } from '@equinor/eds-icons'
export type TitleContentProps = {
- styles?: BlockFieldStyle[]
+ styles?: BlockStyleDefinition[]
highlight?: boolean
}
-/*export type TitleContentProps = {
- highlight?: boolean
- extraLarge?: boolean
- isBigTitle?: boolean
- large?: {
- title: string
- value: 'normal'
- component?: ({ children }: { children: React.ReactNode }) => JSX.Element
- }
-}*/
-
// TODO: Add relevant styles for titles (i.e. highlighted text)
-export const configureTitleBlockContent = (options: TitleContentProps = {}): BlockFieldType => {
+export const configureTitleBlockContent = (options: TitleContentProps = {}): BlockDefinition => {
const { highlight = false, styles } = options
const defaultStyle = {
title: 'Normal',
value: 'normal',
}
- const config: BlockFieldType = {
+ const config: BlockDefinition = {
type: 'block',
+ name: 'block',
styles: styles ? styles : [defaultStyle],
lists: [],
marks: {
@@ -71,7 +61,7 @@ export const configureTitleBlockContent = (options: TitleContentProps = {}): Blo
component: HighlightTextRender,
}
if (highlight) {
- config.marks.decorators.push(textColorConfig)
+ config.marks?.decorators?.push(textColorConfig)
}
return config
}
diff --git a/sanityv3/types/schemaTypes.d.ts b/sanityv3/types/schemaTypes.d.ts
index e693215d5..060eb679b 100644
--- a/sanityv3/types/schemaTypes.d.ts
+++ b/sanityv3/types/schemaTypes.d.ts
@@ -28,18 +28,3 @@ export interface ReferenceFilter {
filter: string // GROQ filter string
params: { [x: string]: any }
}
-
-export type BlockFieldStyle = {
- title: string
- value: string
- component?: ({ children }: { children: React.ReactNode }) => JSX.Element
-}
-export type BlockFieldType = {
- type: string
- styles: BlockFieldStyle[]
- lists: { title: string; value: string }[] | []
- marks: {
- decorators: any[]
- annotations: any[]
- }
-}
From af8ec6097c14869336d5cb3e1dcc03cdc392c5d0 Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Thu, 2 Nov 2023 21:33:18 +0530
Subject: [PATCH 05/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20After=20review=20#18?=
=?UTF-8?q?87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sanityv3/schemas/editors/titleEditorContentType.tsx | 2 +-
web/pageComponents/shared/Hero/DefaultHero.tsx | 4 ++--
web/pageComponents/shared/Hero/FiftyFiftyHero.tsx | 7 +++++--
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/sanityv3/schemas/editors/titleEditorContentType.tsx b/sanityv3/schemas/editors/titleEditorContentType.tsx
index 16f92434e..191599d5d 100644
--- a/sanityv3/schemas/editors/titleEditorContentType.tsx
+++ b/sanityv3/schemas/editors/titleEditorContentType.tsx
@@ -55,7 +55,7 @@ export const configureTitleBlockContent = (options: TitleContentProps = {}): Blo
}
const textColorConfig = {
- title: 'HighLight',
+ title: 'Highlight',
value: 'highlight',
icon: EdsBlockEditorIcon(format_color_text),
component: HighlightTextRender,
diff --git a/web/pageComponents/shared/Hero/DefaultHero.tsx b/web/pageComponents/shared/Hero/DefaultHero.tsx
index 8b43aa4e7..0af0c2c01 100644
--- a/web/pageComponents/shared/Hero/DefaultHero.tsx
+++ b/web/pageComponents/shared/Hero/DefaultHero.tsx
@@ -50,8 +50,8 @@ export const DefaultHero = ({ title, image, isBigTitle, bigTitle }: Props) => {
<>
{isBigTitle && (
<>
- {title && }
- {bigTitle && }
+ {title && }
+ {bigTitle && }
>
)}
{!isBigTitle && {title && }}
diff --git a/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx b/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
index e122868f5..0d6c37e16 100644
--- a/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
+++ b/web/pageComponents/shared/Hero/FiftyFiftyHero.tsx
@@ -53,8 +53,9 @@ const StyledIngress = styled.div`
display: none;
}
`
-const StyledHeroTitle = styled(TitleText)`
+const StyledHeroTitle = styled(TitleText).attrs((props: { $isBigTitle: boolean }) => props)`
max-width: 1186px; /* 1920 - (2 * 367) */
+ font-weight: ${(props) => (props.$isBigTitle ? 'var(--fontWeight-regular)' : 'var(--fontWeight-medium)')};
`
const HeroActionLink = ({ action, ...rest }: { action: LinkData }) => {
@@ -96,7 +97,9 @@ export const FiftyFiftyHero = ({ title, ingress, link, background, figure, isBig
)}
- {title && }
+ {title && (
+
+ )}
{ingress && !isBigTitle && (
Date: Mon, 6 Nov 2023 11:40:33 +0530
Subject: [PATCH 06/14] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Test=20#1626?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/dataset-backup.yaml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/dataset-backup.yaml b/.github/workflows/dataset-backup.yaml
index 021b7fa88..b17a236ef 100644
--- a/.github/workflows/dataset-backup.yaml
+++ b/.github/workflows/dataset-backup.yaml
@@ -8,12 +8,12 @@ on:
options:
- "['global-development']"
- "['global-test']"
- - all
+ - 'all'
required: true
- default: all
+ default: 'all'
schedule:
# Runs at 02:00 UTC every sunday
- - cron: '0 2 * * 0'
+ - cron: '7 3 * * 1' #'0 2 * * 0'
env:
BUILD_ARTIFACT_PATH: ${{ github.workspace }}/backups
jobs:
From 511825e3ed695bd18b57aa0f2e3bada4d55b3957 Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Mon, 6 Nov 2023 11:43:06 +0530
Subject: [PATCH 07/14] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Time=20#1626?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/dataset-backup.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dataset-backup.yaml b/.github/workflows/dataset-backup.yaml
index b17a236ef..a236a15fc 100644
--- a/.github/workflows/dataset-backup.yaml
+++ b/.github/workflows/dataset-backup.yaml
@@ -13,7 +13,7 @@ on:
default: 'all'
schedule:
# Runs at 02:00 UTC every sunday
- - cron: '7 3 * * 1' #'0 2 * * 0'
+ - cron: '6 15 * * 1' #'0 2 * * 0'
env:
BUILD_ARTIFACT_PATH: ${{ github.workspace }}/backups
jobs:
From 94a80a3cdc629f706f3e4ccd7934fc6aeac37933 Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Mon, 6 Nov 2023 12:12:34 +0530
Subject: [PATCH 08/14] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Adjust=20time=20to?=
=?UTF-8?q?=20check=20#1626?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/dataset-backup.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dataset-backup.yaml b/.github/workflows/dataset-backup.yaml
index a236a15fc..2e7ce8c76 100644
--- a/.github/workflows/dataset-backup.yaml
+++ b/.github/workflows/dataset-backup.yaml
@@ -13,7 +13,7 @@ on:
default: 'all'
schedule:
# Runs at 02:00 UTC every sunday
- - cron: '6 15 * * 1' #'0 2 * * 0'
+ - cron: '7 0 * * 1' #'0 2 * * 0'
env:
BUILD_ARTIFACT_PATH: ${{ github.workspace }}/backups
jobs:
From 85e94b618d31cda99921e4cef7443e5c8577bf7b Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Tue, 7 Nov 2023 17:30:03 +0530
Subject: [PATCH 09/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20After=20review=20#18?=
=?UTF-8?q?87?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../documents/header/sharedHeaderFields.ts | 10 +++----
.../editors/titleEditorContentType.tsx | 28 +++++++++++--------
web/components/src/Heading/Heading.tsx | 5 ----
3 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/sanityv3/schemas/documents/header/sharedHeaderFields.ts b/sanityv3/schemas/documents/header/sharedHeaderFields.ts
index f721d1cd5..c5050992d 100644
--- a/sanityv3/schemas/documents/header/sharedHeaderFields.ts
+++ b/sanityv3/schemas/documents/header/sharedHeaderFields.ts
@@ -9,7 +9,7 @@ const bigTitleRoles = ['administrator', 'developer', 'editor'] // allow editor u
type DocumentType = { parent: Hero; currentUser: CurrentUser }
type Hero = {
- heroType?: string
+ heroType?: HeroTypes
isBigTitle?: boolean
}
@@ -31,7 +31,7 @@ const isBigTitle = {
return !(parent?.heroType === HeroTypes.FIFTY_FIFTY || parent?.heroType === HeroTypes.DEFAULT)
},
readOnly: ({ currentUser }: DocumentType) => {
- return !currentUser.roles.find(({ name }: any) => bigTitleRoles.includes(name))
+ return !currentUser.roles.find(({ name }) => bigTitleRoles.includes(name))
},
}
@@ -56,7 +56,7 @@ const heroBigTitleDefault = {
: true,
),
readOnly: ({ currentUser }: DocumentType) => {
- return !currentUser.roles.find(({ name }: any) => bigTitleRoles.includes(name))
+ return !currentUser.roles.find(({ name }) => bigTitleRoles.includes(name))
},
}
@@ -73,8 +73,8 @@ const heroBigTitleFiftyFifty = {
? 'Title is required'
: true,
),
- readOnly: ({ currentUser }: any) => {
- return !currentUser.roles.find(({ name }: any) => bigTitleRoles.includes(name))
+ readOnly: ({ currentUser }: DocumentType) => {
+ return !currentUser.roles.find(({ name }) => bigTitleRoles.includes(name))
},
}
diff --git a/sanityv3/schemas/editors/titleEditorContentType.tsx b/sanityv3/schemas/editors/titleEditorContentType.tsx
index 191599d5d..a09a64dc8 100644
--- a/sanityv3/schemas/editors/titleEditorContentType.tsx
+++ b/sanityv3/schemas/editors/titleEditorContentType.tsx
@@ -3,6 +3,7 @@ import { IconSuperScript, IconSubScript, EdsBlockEditorIcon } from '../../icons'
import { StrikethroughIcon } from '@sanity/icons'
import { BlockDefinition, BlockStyleDefinition } from 'sanity'
import { format_color_text } from '@equinor/eds-icons'
+import React from 'react'
export type TitleContentProps = {
styles?: BlockStyleDefinition[]
@@ -10,17 +11,22 @@ export type TitleContentProps = {
}
// TODO: Add relevant styles for titles (i.e. highlighted text)
-export const configureTitleBlockContent = (options: TitleContentProps = {}): BlockDefinition => {
+export const configureTitleBlockContent = (
+ options: TitleContentProps = {
+ styles: [
+ {
+ title: 'Normal',
+ value: 'normal',
+ },
+ ],
+ },
+): BlockDefinition => {
const { highlight = false, styles } = options
- const defaultStyle = {
- title: 'Normal',
- value: 'normal',
- }
const config: BlockDefinition = {
type: 'block',
name: 'block',
- styles: styles ? styles : [defaultStyle],
+ styles: styles,
lists: [],
marks: {
decorators: [
@@ -49,17 +55,15 @@ export const configureTitleBlockContent = (options: TitleContentProps = {}): Blo
},
}
- const HighlightTextRender = (props: any) => {
- const { children } = props
- return {children}
- }
-
const textColorConfig = {
title: 'Highlight',
value: 'highlight',
icon: EdsBlockEditorIcon(format_color_text),
- component: HighlightTextRender,
+ component: ({ children }: { children: React.ReactNode }) => {
+ return {children}
+ },
}
+
if (highlight) {
config.marks?.decorators?.push(textColorConfig)
}
diff --git a/web/components/src/Heading/Heading.tsx b/web/components/src/Heading/Heading.tsx
index 1dda527fb..2c0d462ee 100644
--- a/web/components/src/Heading/Heading.tsx
+++ b/web/components/src/Heading/Heading.tsx
@@ -27,11 +27,6 @@ const StyledHeading = styled(Typography)`
.inverted-background & {
color: var(--inverted-text);
}
-
- strong,
- b {
- font-weight: var(--fontWeight-medium);
- }
`
export type HeadingProps = {
From f6d815eceb0d20f1e829de78c9d2e6366ade53b7 Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Wed, 8 Nov 2023 13:26:22 +0530
Subject: [PATCH 10/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Hero=20title=20groq?=
=?UTF-8?q?=20#1887?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/lib/queries/common/heroFields.ts | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/web/lib/queries/common/heroFields.ts b/web/lib/queries/common/heroFields.ts
index 507b94641..57db05567 100644
--- a/web/lib/queries/common/heroFields.ts
+++ b/web/lib/queries/common/heroFields.ts
@@ -4,7 +4,10 @@ export const heroFields = /* groq */ `{
"type": coalesce(heroType, 'default'),
"ratio": heroRatio,
"isBigTitle":isBigTitle,
- "title": select(isBigTitle => select( heroType == 'fiftyFifty' => heroBigTitleFiftyFifty, heroBigTitleDefault) , heroTitle),
+ "title": select(
+ heroType == 'fiftyFifty' => select(isBigTitle => heroBigTitleFiftyFifty,heroTitle),
+ heroType == coalesce(heroType, 'default') => select(isBigTitle => heroBigTitleDefault)
+ ) ,
"ingress": heroIngress,
"background": coalesce(heroBackground.title, 'White'),
"figure": select(
From a4e2f590c4f9cc24712e149118cee66fd0462748 Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Wed, 8 Nov 2023 13:32:06 +0530
Subject: [PATCH 11/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Avoid=20confusion=20?=
=?UTF-8?q?#1887?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/lib/queries/common/heroFields.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/web/lib/queries/common/heroFields.ts b/web/lib/queries/common/heroFields.ts
index 57db05567..4e5f3d729 100644
--- a/web/lib/queries/common/heroFields.ts
+++ b/web/lib/queries/common/heroFields.ts
@@ -6,7 +6,7 @@ export const heroFields = /* groq */ `{
"isBigTitle":isBigTitle,
"title": select(
heroType == 'fiftyFifty' => select(isBigTitle => heroBigTitleFiftyFifty,heroTitle),
- heroType == coalesce(heroType, 'default') => select(isBigTitle => heroBigTitleDefault)
+ heroType == 'default' => select(isBigTitle => heroBigTitleDefault)
) ,
"ingress": heroIngress,
"background": coalesce(heroBackground.title, 'White'),
From 0b83989061b513bab2be8c9b9e8dffe3d029d67c Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Thu, 9 Nov 2023 14:14:01 +0530
Subject: [PATCH 12/14] =?UTF-8?q?=E2=9A=97=EF=B8=8F=20Back=20to=20sunday?=
=?UTF-8?q?=20#1626?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/dataset-backup.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dataset-backup.yaml b/.github/workflows/dataset-backup.yaml
index 2e7ce8c76..5fdad5ad1 100644
--- a/.github/workflows/dataset-backup.yaml
+++ b/.github/workflows/dataset-backup.yaml
@@ -13,7 +13,7 @@ on:
default: 'all'
schedule:
# Runs at 02:00 UTC every sunday
- - cron: '7 0 * * 1' #'0 2 * * 0'
+ - cron: '0 2 * * 0'
env:
BUILD_ARTIFACT_PATH: ${{ github.workspace }}/backups
jobs:
From e9583fd0bcaaf1ed14ea0723dbebf2c51e9bce8d Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Fri, 10 Nov 2023 11:44:45 +0530
Subject: [PATCH 13/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20groq=20qu?=
=?UTF-8?q?ery=20#1951?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/lib/queries/common/heroFields.ts | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/web/lib/queries/common/heroFields.ts b/web/lib/queries/common/heroFields.ts
index 4e5f3d729..8441effe5 100644
--- a/web/lib/queries/common/heroFields.ts
+++ b/web/lib/queries/common/heroFields.ts
@@ -4,10 +4,12 @@ export const heroFields = /* groq */ `{
"type": coalesce(heroType, 'default'),
"ratio": heroRatio,
"isBigTitle":isBigTitle,
- "title": select(
- heroType == 'fiftyFifty' => select(isBigTitle => heroBigTitleFiftyFifty,heroTitle),
- heroType == 'default' => select(isBigTitle => heroBigTitleDefault)
- ) ,
+ heroType == 'fiftyFifty' => {
+ "title" : select(isBigTitle => heroBigTitleFiftyFifty,heroTitle),
+ },
+ heroType == "default" => {
+ "title" : select(isBigTitle => heroBigTitleDefault),
+ },
"ingress": heroIngress,
"background": coalesce(heroBackground.title, 'White'),
"figure": select(
From 4fc1607ca9bd40fd23cf08685bf6ba6c3fafd2ce Mon Sep 17 00:00:00 2001
From: Padmaja <52911293+padms@users.noreply.github.com>
Date: Fri, 10 Nov 2023 16:10:42 +0530
Subject: [PATCH 14/14] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Make=20readable=20gr?=
=?UTF-8?q?oq=20#1887?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
web/lib/queries/common/heroFields.ts | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/web/lib/queries/common/heroFields.ts b/web/lib/queries/common/heroFields.ts
index 8441effe5..766819574 100644
--- a/web/lib/queries/common/heroFields.ts
+++ b/web/lib/queries/common/heroFields.ts
@@ -4,11 +4,12 @@ export const heroFields = /* groq */ `{
"type": coalesce(heroType, 'default'),
"ratio": heroRatio,
"isBigTitle":isBigTitle,
- heroType == 'fiftyFifty' => {
- "title" : select(isBigTitle => heroBigTitleFiftyFifty,heroTitle),
+ "title": heroTitle,
+ heroType == 'fiftyFifty' && isBigTitle => {
+ "title" : heroBigTitleFiftyFifty,
},
- heroType == "default" => {
- "title" : select(isBigTitle => heroBigTitleDefault),
+ heroType == "default" && isBigTitle => {
+ "title" : heroBigTitleDefault,
},
"ingress": heroIngress,
"background": coalesce(heroBackground.title, 'White'),