Skip to content

Commit 92801f4

Browse files
committed
use constant instead of hardcoded number
1 parent ed2ef3c commit 92801f4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/ScrollToAnchors.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* If there is any hash we check if component has element with such id and scroll to it.
88
*/
99
import React from 'react'
10-
import { SCROLL_TO_MARGIN, SCROLL_TO_DURATION } from '../config/constants'
10+
import { SCROLL_TO_MARGIN, SCROLL_TO_DURATION, SCREEN_BREAKPOINT_MD } from '../config/constants'
1111
import { scroller } from 'react-scroll'
1212

1313
/**
@@ -24,7 +24,7 @@ export function scrollToHash(hash) {
2424
scroller.scrollTo(id, {
2525
spy: true,
2626
smooth: true,
27-
offset: windowWidth < 768 ? 0 : -SCROLL_TO_MARGIN,
27+
offset: windowWidth < SCREEN_BREAKPOINT_MD ? 0 : -SCROLL_TO_MARGIN,
2828
duration: SCROLL_TO_DURATION,
2929
activeClass: 'active'
3030
})

0 commit comments

Comments
 (0)