aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/templates/page
Commit message (Collapse)AuthorAgeFilesLines
* fix(styles): increase CSS specifity for some selectorsArmand Philippot2023-12-201-5/+7
| | | | | | | | | | | Since `sideEffects` has been added to activate tree shakings, the styles are imported in the wrong order in production build. There is an open issue (again) on Next.js repo. I'm not sure it will be fixed soon so in the meantime I had to increase the specifity of some selectors to avoid broken styles. I also fixed two minor layout errors: * CV page widgets should use headings of level 2 * Homepage should wrap the cards in list items
* refactor(stories): migrate stories to CSF3 formatArmand Philippot2023-12-157-559/+498
|
* refactor(pages): rewrite helpers to output schema in json-ld formatArmand Philippot2023-12-142-3/+7
| | | | | | | | | | | | | * 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-238-16/+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): replace PageLayout template with PageArmand Philippot2023-11-2022-1017/+1846
| | | | | | | | | * 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(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-111-8/+1
| | | | | | * remove searchPage prop (the consumer should handle the submit) * change onSubmit type * use `useForm` hook to handle the form
* refactor(components): rewrite Breadcrumbs componentArmand Philippot2023-11-112-8/+11
|
* 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): 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 Notice componentArmand Philippot2023-11-111-10/+6
| | | | * Rename message prop to children prop and set ReactNode as type
* 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 Button and ButtonLink componentsArmand Philippot2023-10-241-11/+9
| | | | | | | | | | | | | | 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
* build: convert project to esmArmand Philippot2023-10-241-0/+1
|
* refactor(components): rewrite form componentsArmand Philippot2023-10-241-7/+7
|
* refactor: use named export for everything except pagesArmand Philippot2023-09-204-40/+32
| | | | | | 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-194-30/+30
| | | | | | 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.
* test: install and configure cypressArmand Philippot2022-06-021-1/+1
| | | | I also configure Jest to avoid conflicts between Cypress and Jest.
* chore: add a search form when posts list prints no resultsArmand Philippot2022-05-241-1/+6
|
* refactor: reduce the number of data transformationArmand Philippot2022-05-232-130/+4
|
* fix: render all images unoptimized in StorybookArmand Philippot2022-05-222-18/+6
| | | | | | There is a bug with next/image and Storybook. I was manually adding `unoptimized` to images. Instead we can use a workaround by adding an extra config in Storybook `preview.js` file.
* fix(comments): allow a depth of 2 instead of 1Armand Philippot2022-05-211-1/+1
| | | | | If I keep 1, some older comments are not displayed because the comments tree was deeper.
* chore: complete Storybook storiesArmand Philippot2022-05-211-0/+24
|
* refactor: rewrite Prism hooks and providersArmand Philippot2022-05-191-4/+1
| | | | | It avoid some hydratation errors on project pages (not in article however) and the hooks are now reusable.
* chore: fix minor styles/typescript issues introduced during refactoringArmand Philippot2022-05-181-0/+1
|
* chore: handle settings changeArmand Philippot2022-05-181-0/+3
|
* chore: use persistent layoutArmand Philippot2022-05-173-45/+25
| | | | | It prevents to rerender the common components between pages (header, footer...).
* chore: adjust articles stylesArmand Philippot2022-05-172-33/+61
| | | | | * change animation on article card hover * change comments section alignment
* chore: adjust and complete missing stylesArmand Philippot2022-05-163-5/+20
| | | | | | * add logo to topics pages and links * add Prism styles to articles * and a few other adjustements
* refactor: use custom hook for breadcrumb items and schemaArmand Philippot2022-05-163-11/+53
|
* chore: improve accessibilityArmand Philippot2022-05-151-2/+16
|
* chore: add Article pagesArmand Philippot2022-05-152-11/+90
|
* chore: add the Blog index pageArmand Philippot2022-05-131-37/+25
|
* chore: add Project single pagesArmand Philippot2022-05-131-0/+5
|
* refactor: rewrite DescriptionList and Meta componentsArmand Philippot2022-05-092-71/+50
| | | | | | The meta can have different layout. The previous implementation was not enough to easily change the layout. Also, I prefer to restrict the meta types and it prevents me to repeat myself for the labels.
* chore: add a PageLayout componentArmand Philippot2022-04-254-0/+861