mirror of
https://github.com/sergeyyarkov/devthread.ru.git
synced 2026-10-11 02:09:04 +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/plugins/line-numbers/prism-line-numbers.css'
|
||||
|
||||
import { ThemeProvider } from "./src/context/ThemeContext"
|
||||
|
||||
export const wrapRootElement = ({ element }) => (
|
||||
<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 query = e.target.value
|
||||
if (query === '') {
|
||||
navigate('/articles')
|
||||
navigate('/articles/')
|
||||
setQuery('')
|
||||
return null
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user