mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 14:34:19 +00:00
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
import React, { useCallback, useContext } from "react"
|
|
import BoxFull from "../base/BoxFull"
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
|
import { faClock } from "@fortawesome/free-solid-svg-icons"
|
|
import useRepositoryEditor from "../../hooks/useRepositoryEditor"
|
|
import ContextLanguage from "../../contexts/ContextLanguage"
|
|
import FormInlineTimeRay from "./FormInlineTimeRay"
|
|
import { ConditionTime } from "../../objects/Condition"
|
|
|
|
|
|
/**
|
|
* A {@link BoxFull} that allows the user to select a Twitter user to search for, and then to add it as a
|
|
* {@link ConditionTime} of a RepositoryEditor.
|
|
*
|
|
* @param props - Additional props to pass to the box.
|
|
* @returns {JSX.Element}
|
|
* @constructor
|
|
*/
|
|
export default function BoxConditionDatetime({ ...props }) {
|
|
const { addCondition } = useRepositoryEditor()
|
|
const { strings } = useContext(ContextLanguage)
|
|
|
|
const submit = useCallback(
|
|
timeRay => addCondition(new ConditionTime(timeRay)),
|
|
[addCondition],
|
|
)
|
|
|
|
return (
|
|
<BoxFull
|
|
header={
|
|
<span>
|
|
{strings.searchBy}
|
|
|
|
<FontAwesomeIcon icon={faClock}/>
|
|
|
|
{strings.byTimePeriod}
|
|
</span>
|
|
}
|
|
{...props}
|
|
>
|
|
<FormInlineTimeRay
|
|
submit={submit}
|
|
/>
|
|
</BoxFull>
|
|
)
|
|
}
|