From 9047f926f4b917e711e5496f61082e6e50da5b0e Mon Sep 17 00:00:00 2001 From: Padmaja <52911293+padms@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:06:35 +0530 Subject: [PATCH 1/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Changes=20after=20revi?= =?UTF-8?q?ew=20#2736?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sanityv3/schemas/documents/page.ts | 10 ++++++++++ web/core/Link/StickyMenuLink.tsx | 5 ++--- web/lib/queries/common/stickyMenu.ts | 3 ++- web/pageComponents/shared/Header.tsx | 7 ++++--- web/types/types.ts | 1 + 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/sanityv3/schemas/documents/page.ts b/sanityv3/schemas/documents/page.ts index 32e001190..bb247705b 100644 --- a/sanityv3/schemas/documents/page.ts +++ b/sanityv3/schemas/documents/page.ts @@ -6,6 +6,7 @@ import sharedHeroFields from './header/sharedHeaderFields' import { EdsIcon } from '../../icons' import { paste } from '@equinor/eds-icons' import { lang } from './langField' +import { description } from '../objects/iframe/sharedIframeFields' export default { type: 'document', @@ -26,6 +27,14 @@ export default { collapsed: true, }, }, + { + title: 'Sticky Menu', + name: 'stickymenu', + options: { + collapsible: true, + collaped: true, + }, + }, ], fields: [ lang, @@ -46,6 +55,7 @@ export default { name: 'stickyMenu', title: 'Sticky Menu', type: 'stickyMenu', + fieldset: 'stickymenu', }, ...sharedHeroFields, { diff --git a/web/core/Link/StickyMenuLink.tsx b/web/core/Link/StickyMenuLink.tsx index 202f2cf20..bb5b671cd 100644 --- a/web/core/Link/StickyMenuLink.tsx +++ b/web/core/Link/StickyMenuLink.tsx @@ -39,8 +39,7 @@ export const StickyMenuLink = forwardRef( )} {!isDownloadable && ( @@ -48,7 +47,7 @@ export const StickyMenuLink = forwardRef( iconData={arrow_down} className="text-energy-red-100 dark:text-white-100 - ml-2" + ml-4" /> )} diff --git a/web/lib/queries/common/stickyMenu.ts b/web/lib/queries/common/stickyMenu.ts index 31af1e380..ede0e5987 100644 --- a/web/lib/queries/common/stickyMenu.ts +++ b/web/lib/queries/common/stickyMenu.ts @@ -8,6 +8,7 @@ content->stickyMenu{ "links": links[]{ ${downloadableFileFields}, ${anchorLinkReferenceFields} -} +}, +"background": coalesce(backgroundColor.key, 'white-100'), } ` diff --git a/web/pageComponents/shared/Header.tsx b/web/pageComponents/shared/Header.tsx index 6abf74869..11690ed01 100644 --- a/web/pageComponents/shared/Header.tsx +++ b/web/pageComponents/shared/Header.tsx @@ -154,14 +154,15 @@ const Header = ({ slugs, menuData, stickyMenuData }: HeaderProps) => { {stickyMenuData && ( -
-
{stickyMenuData?.title}
+
+
{stickyMenuData?.title}
{anchorReference?.title} {resourceLink && ( - {' '} {resourceLink.label} )} diff --git a/web/types/types.ts b/web/types/types.ts index 386d7affb..a21a4eb16 100644 --- a/web/types/types.ts +++ b/web/types/types.ts @@ -489,4 +489,5 @@ export type StickyMenuData = { type: 'stickyMenu' title: string links: StickyMenuLinkType[] + background: string } From 61ca7873c43ea7a738774ecc7bf8c314ffd24689 Mon Sep 17 00:00:00 2001 From: Padmaja <52911293+padms@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:38:38 +0530 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=92=84=20Fix=20bg=20in=20tw=20#2736?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/pageComponents/shared/Header.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/pageComponents/shared/Header.tsx b/web/pageComponents/shared/Header.tsx index 11690ed01..4918a02b3 100644 --- a/web/pageComponents/shared/Header.tsx +++ b/web/pageComponents/shared/Header.tsx @@ -16,6 +16,7 @@ import { getAllSitesLink } from '../../common/helpers/getAllSitesLink' import { Icon } from '@equinor/eds-core-react' import { ButtonLink, LogoLink, StickyMenuLink } from '@core/Link' import SiteMenu from '@sections/SiteMenu/SiteMenu' +import { ColorKeyTokens, colorKeyToUtilityMap } from '../../styles/colorKeyToUtilityMap' const TopbarOffset = createGlobalStyle` body { @@ -109,6 +110,9 @@ const Header = ({ slugs, menuData, stickyMenuData }: HeaderProps) => { const anchorReference = stickyMenuData?.links.find((it) => it.type == 'anchorLinkReference') const resourceLink = stickyMenuData?.links.find((it) => it.type == 'downloadableFile') + const stickyMenuKey = (stickyMenuData?.background as keyof ColorKeyTokens) || ('white-100' as keyof ColorKeyTokens) + const twBg = colorKeyToUtilityMap[stickyMenuKey]?.background + return (
@@ -155,7 +159,7 @@ const Header = ({ slugs, menuData, stickyMenuData }: HeaderProps) => { {stickyMenuData && (
{stickyMenuData?.title}
From c4669b0391f86f146bf2c8401a723d9a5c219a71 Mon Sep 17 00:00:00 2001 From: Padmaja <52911293+padms@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:44:47 +0530 Subject: [PATCH 3/4] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Fix=20after=20comments?= =?UTF-8?q?=20#2736?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/core/Link/StickyMenuLink.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/core/Link/StickyMenuLink.tsx b/web/core/Link/StickyMenuLink.tsx index bb5b671cd..74a2a7522 100644 --- a/web/core/Link/StickyMenuLink.tsx +++ b/web/core/Link/StickyMenuLink.tsx @@ -34,12 +34,12 @@ export const StickyMenuLink = forwardRef( return ( {isDownloadable && } - {children} +
{children}
{isDownloadable && ( )} {!isDownloadable && ( From a67eee3a33c66adefcbc72bfd494da23ffdd8d97 Mon Sep 17 00:00:00 2001 From: Padmaja <52911293+padms@users.noreply.github.com> Date: Wed, 22 Jan 2025 18:05:03 +0530 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=90=9B=20Handle=20error=20#2736?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sanityv3/schemas/objects/stickyMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sanityv3/schemas/objects/stickyMenu.tsx b/sanityv3/schemas/objects/stickyMenu.tsx index d47b0a738..7e0b5d323 100644 --- a/sanityv3/schemas/objects/stickyMenu.tsx +++ b/sanityv3/schemas/objects/stickyMenu.tsx @@ -30,7 +30,7 @@ export default { Rule.unique() .max(2) .custom((value: any) => { - if (value.length == 2 && value[0]._type == value[1]._type) return 'Cannot have two links of same type' + if (value?.length == 2 && value[0]._type == value[1]._type) return 'Cannot have two links of same type' return true }), },