mirror of
https://github.com/sergeyyarkov/devthread.ru.git
synced 2026-10-11 10:19:13 +03:00
false onUpdateScroll after search
This commit is contained in:
parent
dd773ee474
commit
472b2acd75
@ -15,8 +15,20 @@ import './src/components/Footer/Footer.scss'
|
|||||||
|
|
||||||
import 'prismjs/themes/prism-tomorrow.css'
|
import 'prismjs/themes/prism-tomorrow.css'
|
||||||
import 'prismjs/plugins/line-numbers/prism-line-numbers.css'
|
import 'prismjs/plugins/line-numbers/prism-line-numbers.css'
|
||||||
|
|
||||||
import { ThemeProvider } from "./src/context/ThemeContext"
|
import { ThemeProvider } from "./src/context/ThemeContext"
|
||||||
|
|
||||||
export const wrapRootElement = ({ element }) => (
|
export const wrapRootElement = ({ element }) => (
|
||||||
<ThemeProvider>{element}</ThemeProvider>
|
<ThemeProvider>{element}</ThemeProvider>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export const shouldUpdateScroll = ({
|
||||||
|
routerProps: { location }
|
||||||
|
}) => {
|
||||||
|
const { pathname } = location
|
||||||
|
const scrollToTopRoutes = [`/`, `/about`, '/contacts', '/books', '/articles']
|
||||||
|
|
||||||
|
if (scrollToTopRoutes.indexOf(pathname) !== -1) window.scrollTo(0, 0)
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
@ -6,7 +6,7 @@ const Search = ({ allArticles, filterArticles, articlesLength, resultsLength, qu
|
|||||||
const handleInput = e => {
|
const handleInput = e => {
|
||||||
const query = e.target.value
|
const query = e.target.value
|
||||||
if (query === '') {
|
if (query === '') {
|
||||||
navigate('/articles')
|
navigate('/articles/')
|
||||||
setQuery('')
|
setQuery('')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user