diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-17 18:31:21 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-17 18:31:21 +0200 |
| commit | 9a186b357b32325cf77fdce39a6c6c9aff76d8a5 (patch) | |
| tree | bfeb790f3cc82f753ac74c9b0130f43189502803 /src/components/organisms/layout/footer.tsx | |
| parent | c77c58e18143233be042c4980a6ed08ae9beac52 (diff) | |
chore: listen scroll to hide/show back to top button
Diffstat (limited to 'src/components/organisms/layout/footer.tsx')
| -rw-r--r-- | src/components/organisms/layout/footer.tsx | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/components/organisms/layout/footer.tsx b/src/components/organisms/layout/footer.tsx index 1426e96..c60afec 100644 --- a/src/components/organisms/layout/footer.tsx +++ b/src/components/organisms/layout/footer.tsx @@ -1,7 +1,9 @@ import Copyright, { type CopyrightProps, } from '@components/atoms/layout/copyright'; -import BackToTop from '@components/molecules/buttons/back-to-top'; +import BackToTop, { + type BackToTopProps, +} from '@components/molecules/buttons/back-to-top'; import Nav, { type NavItem } from '@components/molecules/nav/nav'; import { FC } from 'react'; import { useIntl } from 'react-intl'; @@ -9,6 +11,10 @@ import styles from './footer.module.scss'; export type FooterProps = { /** + * Set additional classnames to the back to top button. + */ + backToTopClassName?: BackToTopProps['className']; + /** * Set additional classnames to the footer element. */ className?: string; @@ -31,7 +37,13 @@ export type FooterProps = { * * Renders a footer with copyright and nav; */ -const Footer: FC<FooterProps> = ({ className, copyright, navItems, topId }) => { +const Footer: FC<FooterProps> = ({ + backToTopClassName, + className = '', + copyright, + navItems, + topId, +}) => { const intl = useIntl(); const ariaLabel = intl.formatMessage({ defaultMessage: 'Footer', @@ -54,7 +66,10 @@ const Footer: FC<FooterProps> = ({ className, copyright, navItems, topId }) => { className={styles.nav} /> )} - <BackToTop target={topId} className={styles['back-to-top']} /> + <BackToTop + target={topId} + className={`${styles['back-to-top']} ${backToTopClassName}`} + /> </footer> ); }; |
