mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-23 15:24:21 +00:00
30 lines
829 B
TypeScript
30 lines
829 B
TypeScript
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"
|
|
|
|
|
|
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
|
|
}
|
|
|
|
if(!instance.state.details.description) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<DescriptionBox
|
|
icon={faUniversity}
|
|
name={instance.state.details.name}
|
|
description={instance.state.details.description}
|
|
/>
|
|
)
|
|
}
|