Skip to content

Commit 3ce46b9

Browse files
authored
move custom tool tip to remain permanent next to scroll to top button (#23551)
1 parent 26d7681 commit 3ce46b9

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

components/ui/ScrollButton/ScrollButton.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useState, useEffect } from 'react'
22
import cx from 'classnames'
33
import { ChevronUpIcon } from '@primer/octicons-react'
4+
import { useTranslation } from '../../hooks/useTranslation'
45

56
export type ScrollButtonPropsT = {
67
className?: string
@@ -9,6 +10,7 @@ export type ScrollButtonPropsT = {
910

1011
export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
1112
const [show, setShow] = useState(false)
13+
const { t } = useTranslation(['scroll_button'])
1214

1315
useEffect(() => {
1416
// show scroll button only when view is scrolled down
@@ -35,9 +37,13 @@ export const ScrollButton = ({ className, ariaLabel }: ScrollButtonPropsT) => {
3537
<div className={cx(className, 'transition-200', show ? 'opacity-100' : 'opacity-0')}>
3638
<button
3739
onClick={onClick}
38-
className={cx(
39-
'tooltipped tooltipped-n tooltipped-no-delay color-bg-accent-emphasis color-fg-on-emphasis circle border-0'
40-
)}
40+
className="color-bg-default color-fg-on-emphasis border-0 d-inline-block mr-2 f6"
41+
>
42+
{t('scroll_to_top')}
43+
</button>
44+
<button
45+
onClick={onClick}
46+
className={cx('color-bg-accent-emphasis color-fg-on-emphasis circle border-0')}
4147
style={{ width: 40, height: 40 }}
4248
aria-label={ariaLabel}
4349
>

0 commit comments

Comments
 (0)