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