aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/templates/layout/layout.tsx
Commit message (Collapse)AuthorAgeFilesLines
* fix(layout): refine pagination when JS is disabledArmand Philippot2023-12-191-0/+11
| | | | | | | | * fix the total number of pages * hide the load more button and the progress bar * remove the informative notice since it is no longer necessary * if the page number is equal to 1, use Blog route directly (NextJS is not able to redirect the user when JS is disabled)
* fix(layout): reset focus on route changeArmand Philippot2023-12-161-2/+16
| | | | | | | I mistakenly removed the `giveFocusToTop` on route change but Next router is still not fully accessible. It is important for keyboard users to be redirected at the top of the page when changing page so we need to reset the focus.
* refactor(pages): rewrite helpers to output schema in json-ld formatArmand Philippot2023-12-141-47/+0
| | | | | | | | | | | | | * make sure url are absolutes * nest breadcrumb schema in webpage schema * trim HTML tags from content/description * use a regular script instead of next/script (with the latter the schema is not updated on route change) * place the script in document head * add keywords, wordCount and readingTime keys in BlogPosting schema * fix breadcrumbs in search page (without query) * add tests (a `MatchInlineSnapshot` will be better but Prettier 3 is not supported yet)
* refactor(components): split Layout component in smaller componentsArmand Philippot2023-11-221-371/+41
| | | | | The previous component was too long and hardly readable. So I splitted it in different part and added tests.
* refactor(components): replace items prop in Navbar componentArmand Philippot2023-11-211-76/+49
| | | | | | | | | | | | | | * replace `items` prop with `children` prop: it is more readable this way, * handle navbar item state inside NavbarItem component: it avoid using three differents states and their methods to do exactly the same thing * remove useAutofocus hook since we can't use it anymore * add `onActivation` and `activationHandlerDelay` prop to NavbarItem component to be able to focus the search input only when the item is activated (it replicates the functioning of useAutofocus hook) * replace `ref` type in SearchForm component: it does not make sense to use an input ref for a form. Instead I use useImperativeHandle to provide different a focus method to the given ref.
* refactor(components): replace PageLayout template with PageArmand Philippot2023-11-201-22/+3
| | | | | | | | | * split pages in smaller components (it is both easier to maintain and more readable, we avoid the use of fragments in pages directory) * extract breadcrumbs from article tag (the navigation is not related to the page contents) * remove useReadingTime hook * remove layout options except `isHome`
* refactor(hooks): replace useRouteChange with useOnRouteChange hookArmand Philippot2023-11-151-3/+3
| | | | | | * handle both event start and event complete * clean the effect * add tests
* refactor(hooks): rewrite useScrollPosition hookArmand Philippot2023-11-151-14/+10
| | | | | | * return the scroll position (both X and Y) * no longer accepts arguments * add tests
* refactor(hooks): remove useSettings hookArmand Philippot2023-11-151-6/+9
| | | | | | | It does not make sense to re-export an existing object through a hook. On some pages both the hook and the object was imported... It is better to use the CONFIG (previously settings) object directly and by doing it we avoid potential errors because of conditional hooks.
* refactor(components): rewrite SearchForm componentArmand Philippot2023-11-111-1/+24
| | | | | | * remove searchPage prop (the consumer should handle the submit) * change onSubmit type * use `useForm` hook to handle the form
* refactor(components): replace Toolbar with Navbar componentArmand Philippot2023-11-111-6/+124
| | | | | | | | * remove SearchModal and SettingsModal components * add a generic NavbarItem component (instead of the previous toolbar items to avoid unreadable styles...) * move FlippingLabel component logic into NavbarItem since it is only used here
* refactor(hooks,provider): move reduce motion setterArmand Philippot2023-11-111-2/+0
| | | | | | | | | | Since the local storage key is not meant to change between the components, it should be set directly inside the app file. So both the local storage and the data attribute should be handle in a provider. I also added a custom document because we need a script to retrieve the stored value in local storage earlier to avoid flashing on hydration.
* refactor(hooks,providers): rewrite useAckee hook and AckeeProviderArmand Philippot2023-11-111-2/+0
|
* refactor(components): remove SiteHeader and SiteFooter componentsArmand Philippot2023-11-111-65/+86
| | | | | They do not help to make the layout more readable (on the contrary I think...) so the props drilling is useless.
* refactor(components): rewrite Copyright componentArmand Philippot2023-11-111-5/+3
| | | | | | | | | * remove `icon` prop (it is confusing because a copyright should have the copyright symbol, the license is not part of the copyright) * reorganize copyright informations I also updated the CC BY SA icon because the elements was in the wrong order.
* refactor(components): rewrite Branding componentArmand Philippot2023-11-111-16/+52
| | | | | | The component should only be responsible of the layout for the logo, the name and the optional baseline. Also, the homepage url could be different from `/` so the consumer should give the right url.
* feat(components): add a generic Flip componentArmand Philippot2023-11-111-3/+28
| | | | | | The flipping animation is used at several places so it makes sense to use a single component to handle the animation. It will avoid styles duplication.
* refactor(components): remove Column and NoScript from atomsArmand Philippot2023-11-111-3/+2
| | | | | | | * Column is a simple div meant to be used inside Columns component so they should live together. * NoScript is only used in Layout component and its name does not make sense since it needs to be used inside a `noscript` element.
* feat(components): replace icons with a generic Icon componentArmand Philippot2023-10-241-17/+12
| | | | | Sizes are also predefined and can be set using the `size` prop, so the consumers should no longer adjust the size in CSS.
* feat(components): add Article, Aside, Footer, Header, Main & NavArmand Philippot2023-10-241-9/+9
| | | | | Some components have been renamed to be able to create Footer, Header and Nav.
* refactor(components): rewrite Button and ButtonLink componentsArmand Philippot2023-10-241-1/+1
| | | | | | | | | | | | | | Both: * move styles to Sass placeholders Button: * add `isPressed` prop to Button * add `isLoading` prop to Button (to differentiate state from disabled) ButtonLink: * replace `external` prop with `isExternal` prop * replace `href` prop with `to` prop
* refactor(routes): replace hardcoded routes with constantsArmand Philippot2023-10-241-23/+37
| | | | | | | | It makes it easier to change a route if needed and it avoid typo mistakes. I also refactored a bit the concerned files to be complient with the new ESlint config. However, I should rewrite the pages to reduce the number of statements.
* refactor: use named export for everything except pagesArmand Philippot2023-09-201-22/+28
| | | | | | Next expect a default export for pages so only those components should use default exports. Everything else should use named exports to reduce the number of import statements.
* refactor(build): replace paths aliases with relative pathsArmand Philippot2023-09-191-15/+15
| | | | | | Using paths aliases starting with "@" can be confusing and can lead to conflict with existings modules. I prefer to use relative paths to avoid extra configuration in tools because of these aliases.
* chore: add aria hidden attribute to SVG iconsArmand Philippot2022-06-071-5/+25
|
* test(unit): fix Jest errors due to images importArmand Philippot2022-06-031-1/+1
| | | | | I mocked some SVG files and moves the branding photo to public directory. It is more a workaround than a real fix but it works so...
* fix: reset focus to top of the page on route changeArmand Philippot2022-05-251-2/+8
|
* build(deps): bump all dependenciesArmand Philippot2022-05-251-4/+5
| | | | | | | I moved the website picture from useSettings to the layout component since it is only used here. This reduce the number of Jest errors. However, there's still some issues with some images import...
* chore: handle settings changeArmand Philippot2022-05-181-4/+6
|
* chore: use persistent layoutArmand Philippot2022-05-171-22/+32
| | | | | It prevents to rerender the common components between pages (header, footer...).
* chore: listen scroll to hide/show back to top buttonArmand Philippot2022-05-171-2/+17
|
* refactor: use custom hook for breadcrumb items and schemaArmand Philippot2022-05-161-3/+23
|
* chore: add Search pageArmand Philippot2022-05-151-1/+2
|
* chore: add homepageArmand Philippot2022-05-031-19/+88
|
* chore: add a Layout componentArmand Philippot2022-04-221-0/+125
It defines the different components used by all other layouts.