aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/templates
Commit message (Collapse)AuthorAgeFilesLines
* chore(layout): improve noscript banner stylesArmand Philippot2023-12-181-1/+9
|
* fix(branding): do not reanimate branding on route changeArmand Philippot2023-12-161-1/+10
| | | | | | | The branding animation should occurs only once. Since we're changing the heading from a h1 to a p and vice-versa, the CSS animation was retriggered. By using a ref to make sure it is the first render, we can prevent this behaviour.
* 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(stories): migrate stories to CSF3 formatArmand Philippot2023-12-159-676/+515
|
* refactor(pages): rewrite helpers to output schema in json-ld formatArmand Philippot2023-12-144-51/+13
| | | | | | | | | | | | | * 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(hooks): rewrite useBreadcrumbs hookArmand Philippot2023-12-122-4/+4
| | | | | | | * use next/router to get the slug instead of using props * handle cases where the current page title is not provided * update JSON-LD schema to match the example in documentation * add tests
* refactor(pages): refine 404 pageArmand Philippot2023-12-091-3/+6
| | | | | * refresh topics and thematics list using hooks * add Cypress tests
* refactor(pages): refine Article pagesArmand Philippot2023-12-018-5/+149
| | | | | | | | | | | * use rehype to update code blocks class names * fix widget heading level (after a level 1 it should always be a level 2 and not 3) * replace Spinner with LoadingPage and LoadingPageComments components to keep layout coherent * refactor useArticle and useComments hooks * fix URLs in JSON LD schema * add Cypress tests
* fix(pages,services): make thematics & topics pages usable againArmand Philippot2023-11-291-1/+1
| | | | | | | | | | When I refactored the fetchers and convertors in #f111685 I forgot to convert WPThematicPreview and WPTopicPreview so the thematics and topics pages was broken. I also: * removed the ToC added by error in #70b4f63 * fix heading styles * fix website url in topics pages
* refactor(services, types): reorganize GraphQL fetchers and data typesArmand Philippot2023-11-271-4/+6
| | | | | | | | | | | | The Typescript mapped types was useful for autocompletion in fetchers but their are harder to maintain. I think it's better to keep each query close to its fetcher to have a better understanding of the fetched data. So I: * colocate queries with their own fetcher * colocate mutations with their own mutator * remove Typescript mapped types for queries and mutations * move data convertors inside graphql services * rename most of data types and fetchers
* refactor(components): integrate sectioned page template into PageArmand Philippot2023-11-2314-207/+224
| | | | | | | | * replace Section component by a generic one (other components should be able to use it) * add a PageSection component * add `hasSections` prop to Page component * remove sectioned-page template
* refactor(components): split Layout component in smaller componentsArmand Philippot2023-11-2216-506/+733
| | | | | 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-2025-1059/+1856
| | | | | | | | | * 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(components): extract MetaItem from MetaListArmand Philippot2023-11-202-43/+46
| | | | | | * replace `items` prop on MetaList with `children` prop: it was too restrictive and the global options was not really useful. It is better too give control to the consumers.
* fix: generate an id for each headings in the page main contentsArmand Philippot2023-11-181-11/+8
| | | | | | | | | | | | | | | | | | | | Since #be4d907 the ids was no longer addded to headings in useHeadingsTree hook. It was a bad practice to manipulate the DOM that way. However, I did not move the implementation elsewhere... To fix this, I now use rehype-slug on both markdown contents and html string coming from WordPress. I'm not sure the dynamic imports are really useful here since the table of contents is on almost all pages but Jest was failing with regular import because of ESM. It is the only thing that makes the tests functional again so... However if we want to test the `updateContentTree` function, Jest fails for the same reason. So I decided to not test this function. I've already spend too much time on this issue. Another problem: the ToC on projects page. Currently we use the ref on the body but the page contents are imported dynamically so the hook is executed before the contents are loaded. It makes the ToC empty... We should refactor the pages so we can use the ref directly on the imported contents.
* 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, hooks): rewrite ToC and useHeadingsTreeArmand Philippot2023-11-141-3/+13
| | | | | | | | | | | | * replace TableOfContents component with TocWidget to keep the name of widget components coherent * replace `wrapper` prop with `tree` prop (the component no longer uses the hook, it is up to the consumer to provide the headings tree) * let consumer handle the widget title * add options to useHeadingsTree hook to retrieve only the wanted headings (and do not assume that h1 is unwanted) * expect an ref object instead of an element in useHeadingsTree hook * rename most of the types involved
* refactor(components): replace LinksListWidget with LinksWidgetArmand Philippot2023-11-141-9/+6
| | | | | | | * avoid List component repeat * rewrite tests and CSS * add an id to LinksWidgetItemData (previously LinksListItems) type because the label could be duplicated
* refactor(components): replace Sharing with SharingWidget componentArmand Philippot2023-11-141-3/+5
| | | | | | | * all the widgets should have a coherent name * fix mailto uri * remove useless CSS * add tests
* refactor(components): rewrite PostsList componentArmand Philippot2023-11-131-2/+28
| | | | | | | | | | | | | | | * remove NoResults component and move logic to Search page * add a usePostsList hook * remove Pagination from PostsList (it is only used if javascript is disabled and not on every posts list) * replace `byYear` prop with `sortByYear` * replace `loadMore` prop with `onLoadMore` * remove `showLoadMoreBtn` (we can use `loadMore` prop instead to determine if we need to display the button) * replace `titleLevel` prop with `headingLvl` * add `firstNewResult` prop to handle focus on the new results when loading more article (we should not focus a useless span but the item directly)
* refactor(components): rewrite CommentsList componentArmand Philippot2023-11-113-16/+113
| | | | | | * use ApprovedCommentProps to make CommentData type * add the author name of the parent on reply form heading * add tests
* refactor(components): rewrite CommentForm componentArmand Philippot2023-11-113-76/+50
| | | | | | * remove `Notice` prop to handle it directly in the form * replace `saveComment` prop with `onSubmit` * use `useForm` hook to handle the form
* refactor(components): rewrite SearchForm componentArmand Philippot2023-11-112-9/+25
| | | | | | * 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-112-30/+127
| | | | | | | | * 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-112-65/+151
| | | | | They do not help to make the layout more readable (on the contrary I think...) so the props drilling is useless.
* refactor(components): rewrite Breadcrumbs componentArmand Philippot2023-11-112-8/+11
|
* 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): replace Meta component with MetaListArmand Philippot2023-11-112-24/+31
| | | | | | It removes items complexity by allowing consumers to use any label/value association. Translations should also be defined by the consumer. Each item can now be configured separately (borders, layout...).
* refactor(components): rewrite Branding componentArmand Philippot2023-11-112-16/+119
| | | | | | 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): merge HeadingButton and Widget componentsArmand Philippot2023-11-112-17/+14
| | | | | | The HeadingButton component was only used inside Widget component and it is not very useful on its own so I merge the two components in a new Collapsible component.
* refactor(components): rewrite BackToTop componentArmand Philippot2023-11-111-1/+1
| | | | | * replace `link` prop with `anchor` prop * add a `label` prop to let consumer handle the accessible name
* refactor(components): rewrite Notice componentArmand Philippot2023-11-111-10/+6
| | | | * Rename message prop to children prop and set ReactNode as type
* refactor(components): remove Column and NoScript from atomsArmand Philippot2023-11-112-3/+17
| | | | | | | * 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 Heading componentArmand Philippot2023-10-242-74/+115
| | | | | | | | | * remove `alignment` and `withMargin` props (consumer should handle that) * move styles to Sass placeholders to avoid repeats with headings coming from WordPress * refactor some other components that depend on Heading to avoid ESlint errors
* refactor(components): rewrite Section componentArmand Philippot2023-10-244-64/+76
| | | | | | * Make it compliant with ESlint rules * Remove mandatory heading, it now depends on the consumer * Change defaults for hasBorder and variant
* refactor(components): rewrite Button and ButtonLink componentsArmand Philippot2023-10-242-12/+10
| | | | | | | | | | | | | | 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.
* build: convert project to esmArmand Philippot2023-10-243-1/+4
|
* refactor(components): rewrite form componentsArmand Philippot2023-10-241-7/+7
|
* refactor: use named export for everything except pagesArmand Philippot2023-09-2013-77/+75
| | | | | | 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-199-54/+54
| | | | | | 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.
* refactor(types): move and rename GraphQL typesArmand Philippot2022-08-201-2/+2
| | | | | | | The api file in services was not really readable. So I move the types and I also rewrite a little the fetch function. I also rename most of the type to avoid conflict with preexisting types (like Node) and to keep consistency.