Skip to content

Commit

Permalink
♻️ Changes after review #2736
Browse files Browse the repository at this point in the history
  • Loading branch information
padms committed Jan 22, 2025
1 parent 89cc1aa commit 9047f92
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
10 changes: 10 additions & 0 deletions sanityv3/schemas/documents/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -26,6 +27,14 @@ export default {
collapsed: true,
},
},
{
title: 'Sticky Menu',
name: 'stickymenu',
options: {
collapsible: true,
collaped: true,
},
},
],
fields: [
lang,
Expand All @@ -46,6 +55,7 @@ export default {
name: 'stickyMenu',
title: 'Sticky Menu',
type: 'stickyMenu',
fieldset: 'stickymenu',
},
...sharedHeroFields,
{
Expand Down
5 changes: 2 additions & 3 deletions web/core/Link/StickyMenuLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ export const StickyMenuLink = forwardRef<HTMLAnchorElement, StickMenuLinkProps>(
<TransformableIcon
iconData={arrow_down}
className="text-energy-red-100
dark:text-white-100 h-[22px] border-energy-red-100 border-b-[2px]
ml-2"
dark:text-white-100 h-[22px] border-energy-red-100 border-b-[2px] ml-4"
/>
)}
{!isDownloadable && (
<TransformableIcon
iconData={arrow_down}
className="text-energy-red-100
dark:text-white-100
ml-2"
ml-4"
/>
)}
</BaseLink>
Expand Down
3 changes: 2 additions & 1 deletion web/lib/queries/common/stickyMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ content->stickyMenu{
"links": links[]{
${downloadableFileFields},
${anchorLinkReferenceFields}
}
},
"background": coalesce(backgroundColor.key, 'white-100'),
}
`
7 changes: 4 additions & 3 deletions web/pageComponents/shared/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,15 @@ const Header = ({ slugs, menuData, stickyMenuData }: HeaderProps) => {
</Topbar.InnerContainer>
</Topbar>
{stickyMenuData && (
<div className="w-full items-center bg-moss-green-50 p-4 grid grid-cols-2 lg:grid-cols-5 gap-2 lg:px-16 lg:gap-16 shadow-top-bar z-40">
<div className="text-center font-bold lg:col-span-3 text-md col-span-2"> {stickyMenuData?.title}</div>
<div
className={`hidden lg:grid w-full items-center bg-${stickyMenuData.background} p-4 grid-cols-2 lg:grid-cols-5 gap-2 lg:px-16 lg:gap-16 shadow-top-bar z-40`}
>
<div className="text-center font-medium lg:col-span-3 text-md col-span-2"> {stickyMenuData?.title}</div>
<StickyMenuLink className="mr-4 place-self-end self-center" href={`#${anchorReference?.anchorReference}`}>
{anchorReference?.title}
</StickyMenuLink>
{resourceLink && (
<StickyMenuLink href={resourceLink.href} isDownloadable>
{' '}
{resourceLink.label}
</StickyMenuLink>
)}
Expand Down
1 change: 1 addition & 0 deletions web/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,4 +489,5 @@ export type StickyMenuData = {
type: 'stickyMenu'
title: string
links: StickyMenuLinkType[]
background: string
}

0 comments on commit 9047f92

Please sign in to comment.