diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-10-04 18:17:35 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-11 18:14:41 +0100 |
| commit | be61ffb6fe500cdbfa83b9cd131b8e72779f23c2 (patch) | |
| tree | 9ac57f4fac173e13c0a461d75a206819be4f3c6f /src/components/organisms/layout | |
| parent | a724b4b38bacc631410627395b0d1190a0e8de0d (diff) | |
refactor(components): rewrite BackToTop component
* replace `link` prop with `anchor` prop
* add a `label` prop to let consumer handle the accessible name
Diffstat (limited to 'src/components/organisms/layout')
| -rw-r--r-- | src/components/organisms/layout/site-footer.tsx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/components/organisms/layout/site-footer.tsx b/src/components/organisms/layout/site-footer.tsx index d767a4d..0866924 100644 --- a/src/components/organisms/layout/site-footer.tsx +++ b/src/components/organisms/layout/site-footer.tsx @@ -50,6 +50,12 @@ export const SiteFooter: FC<SiteFooterProps> = ({ description: 'SiteFooter: an accessible name for the footer nav', id: 'pRzkFR', }); + const backToTop = intl.formatMessage({ + defaultMessage: 'Back to top', + description: 'SiteFooter: an accessible name for the back to top button', + id: 'OHvb01', + }); + const backToTopAnchor = `#${topId}`; const footerClass = `${styles.wrapper} ${className}`; const btnClass = `${styles['back-to-top']} ${backToTopClassName}`; @@ -69,7 +75,11 @@ export const SiteFooter: FC<SiteFooterProps> = ({ kind="footer" /> ) : null} - <BackToTop className={btnClass} to={topId} /> + <BackToTop + anchor={backToTopAnchor} + className={btnClass} + label={backToTop} + /> </Footer> ); }; |
