From be61ffb6fe500cdbfa83b9cd131b8e72779f23c2 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 4 Oct 2023 18:17:35 +0200
Subject: refactor(components): rewrite BackToTop component

* replace `link` prop with `anchor` prop
* add a `label` prop to let consumer handle the accessible name
---
 src/components/molecules/buttons/back-to-top.tsx | 46 ------------------------
 1 file changed, 46 deletions(-)
 delete mode 100644 src/components/molecules/buttons/back-to-top.tsx

(limited to 'src/components/molecules/buttons/back-to-top.tsx')

diff --git a/src/components/molecules/buttons/back-to-top.tsx b/src/components/molecules/buttons/back-to-top.tsx
deleted file mode 100644
index f2e2073..0000000
--- a/src/components/molecules/buttons/back-to-top.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import type { FC, HTMLAttributes } from 'react';
-import { useIntl } from 'react-intl';
-import { ButtonLink, Icon } from '../../atoms';
-import styles from './back-to-top.module.scss';
-
-export type BackToTopProps = HTMLAttributes<HTMLDivElement> & {
-  /**
-   * Define the element id to us as anchor.
-   */
-  to: string;
-};
-
-/**
- * BackToTop component
- *
- * Render a back to top link.
- */
-export const BackToTop: FC<BackToTopProps> = ({
-  className = '',
-  to,
-  ...props
-}) => {
-  const intl = useIntl();
-  const linkName = intl.formatMessage({
-    defaultMessage: 'Back to top',
-    description: 'BackToTop: link text',
-    id: 'm+SUSR',
-  });
-  const btnClass = `${styles.wrapper} ${className}`;
-  const anchor = `#${to}`;
-
-  return (
-    <div {...props} className={btnClass}>
-      <ButtonLink
-        aria-label={linkName}
-        className={styles.link}
-        // eslint-disable-next-line react/jsx-no-literals -- Shape allowed
-        shape="square"
-        to={anchor}
-      >
-        {/* eslint-disable-next-line react/jsx-no-literals -- Config allowed */}
-        <Icon aria-hidden={true} orientation="top" shape="arrow" />
-      </ButtonLink>
-    </div>
-  );
-};
-- 
cgit v1.2.3

