File tree Expand file tree Collapse file tree 4 files changed +43
-14
lines changed Expand file tree Collapse file tree 4 files changed +43
-14
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useCallback , useEffect } from "react" ;
2
2
import classNames from "classnames" ;
3
+ import { siteSpecific } from "../../services" ;
4
+ import { Button } from "reactstrap" ;
3
5
4
6
export const ScrollToTop = ( { mainContent} : { mainContent : React . MutableRefObject < HTMLElement | null > } ) => {
5
7
const [ sticky , setSticky ] = React . useState ( false ) ;
@@ -15,10 +17,24 @@ export const ScrollToTop = ({mainContent}: {mainContent: React.MutableRefObject<
15
17
} ;
16
18
} , [ isSticky ] ) ;
17
19
18
- return < button
19
- onClick = { ( ) => mainContent . current ?. scrollIntoView ( { behavior : 'smooth' } ) }
20
- className = { classNames ( "scroll-btn d-print-none" , { "is-sticky" : sticky } ) }
21
- >
22
- < img src = "/assets/common/icons/chevron-up.svg" alt = "Scroll to top of page" />
23
- </ button > ;
24
- } ;
20
+ return siteSpecific (
21
+ < Button
22
+ color = "keyline"
23
+ className = { classNames ( "scroll-btn d-print-none p-2" , { "is-sticky" : sticky } ) }
24
+ onClick = { ( ) => mainContent . current ?. scrollIntoView ( { behavior : 'smooth' } ) }
25
+ tabIndex = { sticky ? 0 : - 1 }
26
+ aria-label = "Scroll to top of page"
27
+ data-bs-theme = "neutral"
28
+ >
29
+ < i className = "icon icon-chevron-up" />
30
+ </ Button > ,
31
+
32
+ < button
33
+ onClick = { ( ) => mainContent . current ?. scrollIntoView ( { behavior : 'smooth' } ) }
34
+ className = { classNames ( "scroll-btn d-print-none" , { "is-sticky" : sticky } ) }
35
+ tabIndex = { sticky ? 0 : - 1 }
36
+ >
37
+ < img src = "/assets/common/icons/chevron-up.svg" alt = "Scroll to top of page" />
38
+ </ button >
39
+ ) ;
40
+ } ;
Original file line number Diff line number Diff line change 1
- .scroll-btn {
1
+ button .btn .scroll-btn {
2
2
position : fixed ;
3
- display : none ; // If not in use hide
3
+ opacity : 0 ;
4
4
height : 45px ;
5
5
width : 45px ;
6
6
justify-content : center ;
7
7
align-items : center ;
8
8
bottom : 10px ;
9
9
right : 10px ;
10
10
box-shadow : 2px 2px 10px 0 #0004 ;
11
- background-color : #fff !important ;
11
+ background-color : #fff ;
12
12
border-radius : 50% ;
13
13
transition : opacity 0.1s linear ;
14
14
z-index : 101 ;
15
- img {
15
+
16
+ & .is-sticky {
17
+ opacity : 1 ;
18
+ display : flex ;
19
+ // TODO: animate opacity on destruction
20
+ }
21
+
22
+ > img {
16
23
margin-top : -4px ;
17
24
height : 80% ;
18
25
width : 80% ;
19
26
}
20
- }
21
27
22
- .is-sticky {
23
- display : flex ;
28
+ > i {
29
+ mask-size : 20px ;
30
+ }
24
31
}
Original file line number Diff line number Diff line change @@ -191,6 +191,7 @@ header {
191
191
.accordion-body {
192
192
background : $color-neutral-50 ;
193
193
padding-top : 1rem ;
194
+ padding-bottom : 1rem ;
194
195
195
196
> a :hover {
196
197
background : $color-neutral-100 ;
Original file line number Diff line number Diff line change 115
115
@include svg-icon (' /assets/phy/icons/redesign/chevron-down.svg' , 16px , 16px );
116
116
}
117
117
118
+ .icon-chevron-up {
119
+ @include svg-icon (' /assets/phy/icons/redesign/chevron-down.svg' , 16px , 16px );
120
+ transform : rotate (180deg );
121
+ }
122
+
118
123
.icon-question-pack {
119
124
@include svg-icon-layered (
120
125
' /assets/phy/icons/redesign/question-pack-fg.svg' ,
You can’t perform that action at this time.
0 commit comments