diff --git a/packages/dnb-design-system-portal/gatsby-browser.tsx b/packages/dnb-design-system-portal/gatsby-browser.tsx index fd20f849934..207da388f15 100644 --- a/packages/dnb-design-system-portal/gatsby-browser.tsx +++ b/packages/dnb-design-system-portal/gatsby-browser.tsx @@ -30,17 +30,8 @@ export const replaceHydrateFunction = () => { export const wrapRootElement = rootElement('browser') export const wrapPageElement = pageElement() -// This was used before during visual testing -// but it looks like they do not safe us any time -// export const disableCorePrefetching = () => { -// return window.IS_TEST -// } -// export const registerServiceWorker = () => { -// return !window.IS_TEST -// } - // scroll to top on route change -export const shouldUpdateScroll = () => true +export const shouldUpdateScroll = () => false export const onRouteUpdate = ({ location, prevLocation }) => { try { @@ -64,3 +55,9 @@ export const onRouteUpdate = ({ location, prevLocation }) => { applyPageFocus('content') } } + +declare global { + interface Document { + startViewTransition(): void + } +} diff --git a/packages/dnb-design-system-portal/src/core/PortalLayout.tsx b/packages/dnb-design-system-portal/src/core/PortalLayout.tsx index ec0928e7201..6f97f2b2351 100644 --- a/packages/dnb-design-system-portal/src/core/PortalLayout.tsx +++ b/packages/dnb-design-system-portal/src/core/PortalLayout.tsx @@ -5,13 +5,14 @@ import React from 'react' import { MDXProvider } from '@mdx-js/react' -import { graphql, useStaticQuery } from 'gatsby' +import { graphql, navigate, useStaticQuery } from 'gatsby' import Layout from '../shared/parts/Layout' import Tabbar from '../shared/tags/Tabbar' import tags from '../shared/tags' import { resetLevels } from '@dnb/eufemia/src/components/Heading' import { setPortalHeadData, usePortalHead } from './PortalHead' import { Breadcrumb } from '@dnb/eufemia/src' +import { startPageTransition } from '../shared/tags/Transition' const ContentWrapper = Tabbar.ContentWrapper @@ -136,11 +137,29 @@ export default function PortalLayout(props: PortalLayoutProps) { return ( {fmData.breadcrumb && ( - + + {fmData.breadcrumb.map((item, i, a) => { + return ( + + ) + + function clickHandler(e) { + e.event.preventDefault() + startPageTransition() + navigate(item.href) + } + })} + )} {currentFm.showTabs && ( diff --git a/packages/dnb-design-system-portal/src/shared/menu/Card.js b/packages/dnb-design-system-portal/src/shared/menu/Card.js index 5a1b0f68cd3..fd06ad92caa 100644 --- a/packages/dnb-design-system-portal/src/shared/menu/Card.js +++ b/packages/dnb-design-system-portal/src/shared/menu/Card.js @@ -15,6 +15,7 @@ import { linkInnerStyle, boxStyle, } from './Card.module.scss' +import { startPageTransition } from '../tags/Transition' export default class Card extends React.PureComponent { static propTypes = { @@ -49,6 +50,7 @@ export default class Card extends React.PureComponent { this.isSelected() && 'current-card', )} to={url} + onClick={startPageTransition} aria-current={this.isSelected()} > diff --git a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.tsx b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.tsx index 93c0c8a5d64..9ef85731239 100644 --- a/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.tsx +++ b/packages/dnb-design-system-portal/src/shared/menu/SidebarMenu.tsx @@ -5,7 +5,7 @@ import React, { useContext, useEffect, useRef } from 'react' import classnames from 'classnames' -import Link from '../parts/Link' +import Anchor from '../tags/Anchor' import { useStaticQuery, graphql } from 'gatsby' import Context from '@dnb/eufemia/src/shared/Context' import { SidebarMenuContext } from './SidebarMenuContext' @@ -318,8 +318,8 @@ function ListItem({ } as React.CSSProperties /* Casting to allow css variable in JSX inline styling */ } > - )} - + {/* Currently not nesting list items with an
    inside
  • as it breaks the styling for the time being */} {subheadings && diff --git a/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js b/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js index e2c3a89e819..510d51a6838 100644 --- a/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js +++ b/packages/dnb-design-system-portal/src/shared/menu/StickyMenuBar.js @@ -6,7 +6,7 @@ import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' -import { useStaticQuery, graphql } from 'gatsby' +import { navigate, useStaticQuery, graphql } from 'gatsby' import { hamburger as hamburgerIcon } from '@dnb/eufemia/src/icons' import { close as closeIcon } from '@dnb/eufemia/src/icons/primary_icons' import PortalLogo from './graphics/logo' @@ -25,6 +25,7 @@ import { portalHeaderWrapperStyle, hideSidebarToggleButtonStyle, } from './StickyMenuBar.module.scss' +import { startPageTransition } from '../tags/Transition' export default function StickyMenuBar({ hideSidebarToggleButton, @@ -66,6 +67,11 @@ export default function StickyMenuBar({ text="Home" title="Eufemia main sections" href="/" + on_click={({ event }) => { + event.preventDefault() + startPageTransition() + navigate('/') + }} icon="chevron_left" icon_position="left" /> diff --git a/packages/dnb-design-system-portal/src/shared/parts/Layout.tsx b/packages/dnb-design-system-portal/src/shared/parts/Layout.tsx index 95714241744..2e7d43b866c 100644 --- a/packages/dnb-design-system-portal/src/shared/parts/Layout.tsx +++ b/packages/dnb-design-system-portal/src/shared/parts/Layout.tsx @@ -17,7 +17,7 @@ import { setPageFocusElement, scrollToLocationHashId, } from '@dnb/eufemia/src/shared/helpers' -import { P, Logo, GlobalStatus } from '@dnb/eufemia/src' +import { P, Logo, GlobalStatus, Button } from '@dnb/eufemia/src' import './PortalStyle.scss' import { portalStyle, @@ -115,6 +115,7 @@ function Layout(props: LayoutProps) { +