diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-14 15:11:22 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-14 19:06:42 +0100 |
| commit | a3a4c50f26b8750ae1c87f1f1103b84b7d2e6315 (patch) | |
| tree | ae286c7c6b3ab4f556f20adf5e42b24641351296 /src/utils | |
| parent | 50f1c501a87ef5f5650750dbeca797e833ec7c3a (diff) | |
refactor(components): replace LinksListWidget with LinksWidget
* avoid List component repeat
* rewrite tests and CSS
* add an id to LinksWidgetItemData (previously LinksListItems) type
because the label could be duplicated
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/helpers/pages.tsx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/utils/helpers/pages.tsx b/src/utils/helpers/pages.tsx index 556b4fb..62a582f 100644 --- a/src/utils/helpers/pages.tsx +++ b/src/utils/helpers/pages.tsx @@ -1,5 +1,5 @@ import NextImage from 'next/image'; -import type { LinksListItems, PostData } from '../../components'; +import type { LinksWidgetItemData, PostData } from '../../components'; import { getArticleFromRawData } from '../../services/graphql'; import type { Article, @@ -61,10 +61,11 @@ export const sortPageLinksByName = (a: PageLink, b: PageLink) => { * @param {PageLink[]} links - An array of page links. * @returns {LinksListItem[]} An array of links items. */ -export const getLinksListItems = (links: PageLink[]): LinksListItems[] => +export const getLinksItemData = (links: PageLink[]): LinksWidgetItemData[] => links.map((link) => { return { - name: link.name, + id: `${link.id}`, + label: link.name, url: link.url, }; }); |
