dataesr / react-dsfr

Non-official React components of the official french Système de Design de l'État.
https://dataesr.github.io/react-dsfr/
MIT License
44 stars 22 forks source link

fix(Footer): :bug: Fix "filter" bug when FooterTopCategory has only o… #311

Closed sylvainlg closed 1 year ago

sylvainlg commented 1 year ago

There is an issue there when the Category contains only one element.

See : https://github.com/dataesr/react-dsfr/blob/31502939cf5e611b6b3c32649d107b334fb550d2/src/components/interface/Footer/FooterTopCategory.js#L15

Could be solved by making sure to have an array :

 const childrenArray = Children.toArray(children);
  const links = childrenArray
    .filter((link) => link && link.props.__TYPE === 'FooterLink')
    .map((link) => cloneElement(link, { section: 'top' }));
  const childs = childrenArray.filter((link) => link.props.__TYPE !== 'FooterLink');
github-actions[bot] commented 1 year ago

:tada: This PR is included in version 3.4.10 :tada:

The release is available on:

Your semantic-release bot :package::rocket: