1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 14:34:19 +00:00
pds-2021-g2-nest/nest_frontend/components/interactive/BoxSetServer.js

38 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-04-26 16:36:41 +00:00
import React, { useContext } from "react"
2021-04-29 14:58:31 +00:00
import BoxFull from "../base/BoxFull"
import FormLabelled from "../base/FormLabelled"
import FormLabel from "../base/formparts/FormLabel"
import InputWithIcon from "../base/InputWithIcon"
2021-04-26 16:36:41 +00:00
import { faGlobe } from "@fortawesome/free-solid-svg-icons"
2021-04-29 14:58:31 +00:00
import ContextServer from "../../contexts/ContextServer"
2021-05-18 00:04:06 +00:00
import ContextLanguage from "../../contexts/ContextLanguage"
2021-04-26 16:36:41 +00:00
/**
* A {@link BoxFull} allowing the user to select the backend server they want to login to.
*
* @param props - Additional props to pass to the box.
* @returns {JSX.Element}
* @constructor
*/
export default function BoxSetServer({ ...props }) {
2021-05-11 14:37:15 +00:00
const { server, setServer } = useContext(ContextServer)
2021-05-18 00:48:34 +00:00
const { strings } = useContext(ContextLanguage)
2021-04-26 16:36:41 +00:00
return (
2021-05-18 00:04:06 +00:00
<BoxFull header={strings.server} {...props}>
2021-04-26 16:36:41 +00:00
<FormLabelled>
2021-05-18 00:04:06 +00:00
<FormLabel text={strings.baseURL} htmlFor={"set-server-base-url"}>
2021-04-26 16:36:41 +00:00
<InputWithIcon
id={"set-server-base-url"}
type={"url"}
icon={faGlobe}
value={server}
onChange={e => setServer(e.target.value)}
/>
</FormLabel>
</FormLabelled>
</BoxFull>
)
}