mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-27 17:54:39 +03:00
Fix dropdowns
This commit is contained in:
parent
3c93913bb9
commit
80144ebad0
|
@ -1,17 +1,18 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import classNames from 'classnames'
|
import classNames from 'classnames'
|
||||||
import { navigate } from 'gatsby'
|
import { useRouter } from 'next/router'
|
||||||
|
|
||||||
import classes from '../styles/dropdown.module.sass'
|
import classes from '../styles/dropdown.module.sass'
|
||||||
|
|
||||||
export default function Dropdown({ defaultValue, className, onChange, children }) {
|
export default function Dropdown({ defaultValue, className, onChange, children }) {
|
||||||
|
const router = useRouter()
|
||||||
const defaultOnChange = ({ target }) => {
|
const defaultOnChange = ({ target }) => {
|
||||||
const isExternal = /((http(s?)):\/\/|mailto:)/gi.test(target.value)
|
const isExternal = /((http(s?)):\/\/|mailto:)/gi.test(target.value)
|
||||||
if (isExternal) {
|
if (isExternal) {
|
||||||
window.location.href = target.value
|
window.location.href = target.value
|
||||||
} else {
|
} else {
|
||||||
navigate(target.value)
|
router.push(target.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user