mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 08:12:24 +03:00
Fix dropdown [ci skip]
This commit is contained in:
parent
dae22f3dfa
commit
bb62e3c8fc
|
@ -6,7 +6,14 @@ import { navigate } from 'gatsby'
|
||||||
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 defaultOnChange = ({ target }) => navigate(target.value)
|
const defaultOnChange = ({ target }) => {
|
||||||
|
const isExternal = /((http(s?)):\/\/|mailto:)/gi.test(target.value)
|
||||||
|
if (isExternal) {
|
||||||
|
window.location.href = target.value
|
||||||
|
} else {
|
||||||
|
navigate(target.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<select
|
<select
|
||||||
defaultValue={defaultValue}
|
defaultValue={defaultValue}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user