mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 14:34:19 +00:00
🐛 Fix reloading on enter
This commit is contained in:
parent
01ed2eadc9
commit
df1f043a49
3 changed files with 15 additions and 6 deletions
|
@ -35,7 +35,7 @@ export default function BoxConditionDatetime({ ...props }) {
|
||||||
return setDatetime(text)
|
return setDatetime(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onButtonClick = () => {
|
const onButtonClick = e => {
|
||||||
const naive = new Date(datetime)
|
const naive = new Date(datetime)
|
||||||
if(naive.toString() === "Invalid Date") {
|
if(naive.toString() === "Invalid Date") {
|
||||||
console.debug("Refusing to add condition: ", naive , " is an Invalid Date.")
|
console.debug("Refusing to add condition: ", naive , " is an Invalid Date.")
|
||||||
|
@ -44,11 +44,14 @@ export default function BoxConditionDatetime({ ...props }) {
|
||||||
const aware = convertToLocalISODate(naive)
|
const aware = convertToLocalISODate(naive)
|
||||||
addCondition(new Condition("TIME", `${ba ? ">" : "<"} ${aware}`))
|
addCondition(new Condition("TIME", `${ba ? ">" : "<"} ${aware}`))
|
||||||
setDatetime("")
|
setDatetime("")
|
||||||
|
|
||||||
|
// Prevent reloading the page!
|
||||||
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faClock}/> time period</span>} {...props}>
|
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faClock}/> time period</span>} {...props}>
|
||||||
<FormInline>
|
<FormInline onSubmit={onButtonClick}>
|
||||||
<ButtonToggleBeforeAfter onUpdate={setBa}/>
|
<ButtonToggleBeforeAfter onUpdate={setBa}/>
|
||||||
<InputWithIcon
|
<InputWithIcon
|
||||||
className={Style.Input}
|
className={Style.Input}
|
||||||
|
|
|
@ -32,14 +32,17 @@ export default function BoxConditionHashtag({ ...props }) {
|
||||||
return setHashtag(text)
|
return setHashtag(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onButtonClick = () => {
|
const onButtonClick = e => {
|
||||||
addCondition(new Condition("HASHTAG", hashtag))
|
addCondition(new Condition("HASHTAG", hashtag))
|
||||||
setHashtag("")
|
setHashtag("")
|
||||||
|
|
||||||
|
// Prevent reloading the page!
|
||||||
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faHashtag}/> hashtag</span>} {...props}>
|
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faHashtag}/> hashtag</span>} {...props}>
|
||||||
<FormInline>
|
<FormInline onSubmit={onButtonClick}>
|
||||||
<InputWithIcon
|
<InputWithIcon
|
||||||
className={Style.Input}
|
className={Style.Input}
|
||||||
id={"condition-hashtag"}
|
id={"condition-hashtag"}
|
||||||
|
|
|
@ -31,14 +31,17 @@ export default function BoxConditionUser({ ...props }) {
|
||||||
return setUser(text)
|
return setUser(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onButtonClick = () => {
|
const onButtonClick = e => {
|
||||||
addCondition(new Condition("USER", user))
|
addCondition(new Condition("USER", user))
|
||||||
setUser("")
|
setUser("")
|
||||||
|
|
||||||
|
// Prevent reloading the page!
|
||||||
|
e.preventDefault()
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faAt}/> user</span>} {...props}>
|
<BoxFull header={<span>Search by <FontAwesomeIcon icon={faAt}/> user</span>} {...props}>
|
||||||
<FormInline>
|
<FormInline onSubmit={onButtonClick}>
|
||||||
<InputWithIcon
|
<InputWithIcon
|
||||||
className={Style.Input}
|
className={Style.Input}
|
||||||
id={"condition-hashtag"}
|
id={"condition-hashtag"}
|
||||||
|
|
Loading…
Reference in a new issue