import type { FC } from 'react';
import { useIntl } from 'react-intl';
import { Copyright, Footer, type CopyrightProps } from '../../atoms';
import {
  BackToTop,
  type BackToTopProps,
  NavList,
  type NavItem,
} from '../../molecules';
import styles from './site-footer.module.scss';

export type SiteFooterProps = {
  /**
   * Set additional classnames to the back to top button.
   */
  backToTopClassName?: BackToTopProps['className'];
  /**
   * Set additional classnames to the footer element.
   */
  className?: string;
  /**
   * Set the copyright information.
   */
  copyright: CopyrightProps;
  /**
   * The footer nav items.
   */
  navItems?: NavItem[];
  /**
   * An element id (without hashtag) used as anchor for back to top button.
   */
  topId: string;
};

/**
 * SiteFooter component
 *
 * Renders a footer with copyright and nav;
 */
export const SiteFooter: FC<SiteFooterProps> = ({
  backToTopClassName,
  className = '',
  copyright,
  navItems,
  topId,
}) => {
  const intl = useIntl();
  const ariaLabel = intl.formatMessage({
    defaultMessage: 'Footer',
    description: 'SiteFooter: an accessible name for the footer nav',
    id: 'pRzkFR',
  });
  const footerClass = `${styles.wrapper} ${className}`;
  const btnClass = `${styles['back-to-top']} ${backToTopClassName}`;

  return (
    <Footer className={footerClass}>
      <Copyright
        dates={copyright.dates}
        icon={copyright.icon}
        owner={copyright.owner}
      />
      {navItems ? (
        <NavList
          aria-label={ariaLabel}
          className={styles.nav}
          items={navItems}
          // eslint-disable-next-line react/jsx-no-literals -- Kind allowed
          kind="footer"
        />
      ) : null}
      <BackToTop className={btnClass} to={topId} />
    </Footer>
  );
};
mponents/atoms/layout/section.test.tsx?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>commit</a><a href='/www.armandphilippot.com/diff/src/components/atoms/layout/section.test.tsx?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>diff</a><a href='/www.armandphilippot.com/stats/src/components/atoms/layout/section.test.tsx?h=v2.0.0'>stats</a></td><td class='form'><form class='right' method='get' action='/www.armandphilippot.com/log/src/components/atoms/layout/section.test.tsx'>
<input type='hidden' name='h' value='v2.0.0'/><input type='hidden' name='id' value='e305cbbdbc49af575e25957f6ab72ccf944339ec'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/www.armandphilippot.com/tree/?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>root</a>/<a href='/www.armandphilippot.com/tree/src?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>src</a>/<a href='/www.armandphilippot.com/tree/src/components?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>components</a>/<a href='/www.armandphilippot.com/tree/src/components/atoms?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>atoms</a>/<a href='/www.armandphilippot.com/tree/src/components/atoms/layout?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>layout</a>/<a href='/www.armandphilippot.com/tree/src/components/atoms/layout/section.test.tsx?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>section.test.tsx</a></div><div class='content'>blob: ca5f03a22764dabbdd9a25bf1593cd1afb3bf453 (<a href='/www.armandphilippot.com/plain/src/components/atoms/layout/section.test.tsx?h=v2.0.0&amp;id=e305cbbdbc49af575e25957f6ab72ccf944339ec'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
<a id='n8' href='#n8'>8</a>
<a id='n9' href='#n9'>9</a>
<a id='n10' href='#n10'>10</a>
<a id='n11' href='#n11'>11</a>
<a id='n12' href='#n12'>12</a>
<a id='n13' href='#n13'>13</a>
<a id='n14' href='#n14'>14</a>
<a id='n15' href='#n15'>15</a>
<a id='n16' href='#n16'>16</a>
<a id='n17' href='#n17'>17</a>
</pre></td>
<td class='lines'><pre><code>