mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-14 20:24:56 +02:00
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
import React from 'react';
|
|
import clsx from 'clsx';
|
|
import {translate} from '@docusaurus/Translate';
|
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
import {useBackToTopButton} from '@docusaurus/theme-common/internal';
|
|
import styles from './styles.module.css';
|
|
export default function BackToTopButton() {
|
|
const {shown, scrollToTop} = useBackToTopButton({threshold: 300});
|
|
return (
|
|
<button
|
|
aria-label={translate({
|
|
id: 'theme.BackToTopButton.buttonAriaLabel',
|
|
message: 'Scroll back to top',
|
|
description: 'The ARIA label for the back to top button',
|
|
})}
|
|
className={clsx(
|
|
'clean-btn',
|
|
ThemeClassNames.common.backToTopButton,
|
|
styles.backToTopButton,
|
|
shown && styles.backToTopButtonShow,
|
|
)}
|
|
type="button"
|
|
onClick={scrollToTop}
|
|
/>
|
|
);
|
|
}
|