1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 23:04:21 +00:00
sophon/frontend/src/components/instance/InstanceDescriptionBox.tsx

27 lines
756 B
TypeScript
Raw Normal View History

2021-10-13 03:05:34 +00:00
import {faUniversity} from "@fortawesome/free-solid-svg-icons"
import * as React from "react"
import {useInstanceContext} from "../../contexts/instance"
import {DescriptionBox} from "../elements/DescriptionBox"
import {ErrorBox} from "../errors/ErrorBox"
2021-10-06 14:41:47 +00:00
export function InstanceDescriptionBox(): JSX.Element | null {
const instance = useInstanceContext()
if(!instance) {
return <ErrorBox error={new Error("This component is being rendered outside an InstanceContext.")}/>
}
if(!instance.state.details) {
return null
}
return (
2021-10-13 03:05:34 +00:00
<DescriptionBox
icon={faUniversity}
name={instance.state.details.name}
description={instance.state.details.description}
/>
)
}