summaryrefslogtreecommitdiffstats
path: root/src/components/templates/layout
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/templates/layout')
-rw-r--r--src/components/templates/layout/layout.tsx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/components/templates/layout/layout.tsx b/src/components/templates/layout/layout.tsx
index 0b1fe99..982b099 100644
--- a/src/components/templates/layout/layout.tsx
+++ b/src/components/templates/layout/layout.tsx
@@ -11,10 +11,11 @@ import NoScript from '@components/atoms/layout/no-script';
import Footer, { type FooterProps } from '@components/organisms/layout/footer';
import Header, { type HeaderProps } from '@components/organisms/layout/header';
import { type NextPageWithLayoutOptions } from '@ts/types/app';
+import useRouteChange from '@utils/hooks/use-route-change';
import useScrollPosition from '@utils/hooks/use-scroll-position';
import useSettings from '@utils/hooks/use-settings';
import Script from 'next/script';
-import { FC, ReactElement, ReactNode, useState } from 'react';
+import { FC, ReactElement, ReactNode, useRef, useState } from 'react';
import { useIntl } from 'react-intl';
import { Person, SearchAction, WebSite, WithContext } from 'schema-dts';
import styles from './layout.module.scss';
@@ -173,6 +174,11 @@ const Layout: FC<LayoutProps> = ({
};
useScrollPosition(updateBackToTopClassName);
+ const topRef = useRef<HTMLSpanElement>(null);
+ const giveFocusToTopRef = () => {
+ if (topRef.current) topRef.current.focus();
+ };
+ useRouteChange(giveFocusToTopRef);
return (
<>
@@ -189,7 +195,7 @@ const Layout: FC<LayoutProps> = ({
<noscript>
<div className={styles['noscript-spacing']}></div>
</noscript>
- <span tabIndex={-1}></span>
+ <span ref={topRef} tabIndex={-1}></span>
<ButtonLink target="#main" className="screen-reader-text">
{skipToContent}
</ButtonLink>
.sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
export const PERSONAL_LINKS = {
  GITHUB: 'https://github.com/ArmandPhilippot',
  GITLAB: 'https://gitlab.com/ArmandPhilippot',
  LINKEDIN: 'https://www.linkedin.com/in/armandphilippot',
  SHAARLI: 'https://shaarli.armandphilippot.com/',
} as const;

/**
 * App routes.
 *
 * All static routes should be configured here to avoid 404 if a route changes.
 */
export const ROUTES = {
  ARTICLE: '/article',
  BLOG: '/blog',
  CONTACT: '/contact',
  CV: '/cv',
  LEGAL_NOTICE: '/mentions-legales',
  NOT_FOUND: '/404',
  PROJECTS: '/projets',
  RSS: '/feed',
  SEARCH: '/recherche',
  THEMATICS: {
    INDEX: '/thematique',
    FREE: '/thematique/libre',
    LINUX: '/thematique/linux',
    WEB_DEV: '/thematique/developpement-web',
  },
  TOPICS: '/sujet',
} as const;

// cSpell:ignore legales thematique developpement