aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/blog
Commit message (Collapse)AuthorAgeFilesLines
* fix(pages,services): make thematics & topics pages usable againArmand Philippot2023-11-292-6/+16
| | | | | | | | | | 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-272-74/+72
| | | | | | | | | | | | 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): replace PageLayout template with PageArmand Philippot2023-11-202-124/+83
| | | | | | | | | * 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-48/+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-3/+11
| | | | | | | | | | | | | | | | | | | | 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): remove useSettings hookArmand Philippot2023-11-152-31/+20
| | | | | | | 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): replace LinksListWidget with LinksWidgetArmand Philippot2023-11-142-12/+12
| | | | | | | * avoid List component repeat * rewrite tests and CSS * add an id to LinksWidgetItemData (previously LinksListItems) type because the label could be duplicated
* refactor(components): rewrite PostsList componentArmand Philippot2023-11-132-19/+153
| | | | | | | | | | | | | | | * 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(hooks): rewrite usePagination hookArmand Philippot2023-11-131-9/+5
| | | | | | | * replace `isLoadingInitialData` with `isLoading` & `isRefreshing` * rename `fallbackData` prop to `fallback` * replace `setSize` return with a `loadMore` callback * add tests
* refactor(components): rewrite SearchForm componentArmand Philippot2023-11-112-2/+0
| | | | | | * remove searchPage prop (the consumer should handle the submit) * change onSubmit type * use `useForm` hook to handle the form
* refactor(components): replace Meta component with MetaListArmand Philippot2023-11-112-2/+48
| | | | | | 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-16/+30
| | | | | | 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-2/+3
| | | | * Rename message prop to children prop and set ReactNode as type
* refactor(routes): replace hardcoded routes with constantsArmand Philippot2023-10-242-50/+72
| | | | | | | | 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-202-43/+38
| | | | | | 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-192-46/+52
| | | | | | 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-202-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.
* chore: add a search form when posts list prints no resultsArmand Philippot2022-05-242-0/+2
|
* fix: ensure all topics/thematics have the base urlArmand Philippot2022-05-232-8/+8
|
* refactor(schema): use helpers function to avoid repeat between pagesArmand Philippot2022-05-232-64/+34
|
* refactor: reduce the number of data transformationArmand Philippot2022-05-232-132/+9
|
* chore: handle blog pagination when JS is disabledArmand Philippot2022-05-202-0/+312
|
* chore: use persistent layoutArmand Philippot2022-05-171-3/+11
| | | | | It prevents to rerender the common components between pages (header, footer...).
* chore: adjust and complete missing stylesArmand Philippot2022-05-161-11/+1
| | | | | | * 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-161-10/+6
|
* chore: add Search pageArmand Philippot2022-05-151-3/+1
|
* chore: add Thematic pageArmand Philippot2022-05-131-16/+12
|
* chore: add blog page widgetsArmand Philippot2022-05-131-9/+81
|
* chore: handle blog paginationArmand Philippot2022-05-131-19/+91
|
* chore: add the Blog index pageArmand Philippot2022-05-131-0/+169
|
* chore: remove old pages, components, helpers and typesArmand Philippot2022-04-292-474/+0
| | | | | Since I'm using new components, I will also rewrite the GraphQL queries so it is easier to start from scratch.
* refactor: use formatjs swc pluginArmand Philippot2022-03-232-1/+17
| | | | | I'm not able to configure SWC plugins in Next.js so to make it works, all translation must have an id.
* fix: add a spinner if blog page is loadingArmand Philippot2022-03-091-0/+3
|
* feat: provide pagination for users with js disabled (#13)Armand Philippot2022-03-092-28/+226
| | | | | | | | | * chore: add a Pagination component * chore: add blog pages * chore: fallback to page number based navigation if JS disabled * chore: update translation
* refactor: replace script tags with next/script (#10)Armand Philippot2022-02-211-4/+6
| | | | | | | | * refactor: replace script tags with next/script Since next.js v12.1.0 some warnings was displayed because I was using some script tags. * build(deps): bump next-themes to v0.1.1
* chore: display initial posts, thematics & topicsArmand Philippot2022-02-141-14/+30
| | | | | By fetching the data in getStaticProps, I can display the data even for users with Javascript disabled.
* chore: add some noscript tags to explain why the data are not loadedArmand Philippot2022-02-131-0/+6
|
* chore: move pagination cursor title in a separate divArmand Philippot2022-02-011-0/+1
| | | | | | The progress bar will be clearer for everyone if the information about the number of loaded articles is printed without hovering the progress bar.
* refactor(config): move config from config dir to utilsArmand Philippot2022-01-291-19/+19
|
* chore: replace lingui functions with react-intlArmand Philippot2022-01-291-15/+63
|
* chore(i18n): replace i18n provider and helpersArmand Philippot2022-01-291-16/+16
|
* fix: handle translation with linguiArmand Philippot2022-01-281-8/+9
| | | | | | | | The previous method was not working so I tried a different approach. Translation is loaded but I'm still getting warnings: * Plurals for locale undefined aren't loaded * Text content did not match I can't figure how to fix them...
* chore: display a progress bar before load more buttonArmand Philippot2022-01-251-5/+26
| | | | | Since I'm using cursor pagination, users cannot know if there is a lot of posts available. With this cursor, they can verify the progression.
* chore: display total found posts in page metaArmand Philippot2022-01-251-2/+7
|
* chore: add opengraph and twitter metaArmand Philippot2022-01-191-3/+10
|
* refactor(config): move defaultLocale as property of config.localesArmand Philippot2022-01-191-2/+2
| | | | | I will need the country code, so I think it makes more sense to gather them inside the same property.
* chore: add structured data using schema.org and JSON-LDArmand Philippot2022-01-191-0/+38
| | | | I also added the featured image on single article.
* chore: add a spinner when content is loadingArmand Philippot2022-01-161-4/+9
|
* chore: update sidebar and widgets stylesArmand Philippot2022-01-151-2/+2
| | | | | | | | | I'm now using a widget that can be expanded/collapsed. It also allows me to handle more effectively widgets overflow and to avoid styles repetitions. However, with stylelint rule "no-descending-specificity", I'm not sure if the stylesheets are really logical... Maybe I should deactivate this rule.
* chore: improve load more button accessibilityArmand Philippot2022-01-141-2/+12
| | | | | | On click, the focus should be moved to the last post in the list instead of keeping it on load more button. It helps to keep a consistent navigation for keyboard users for example.