blob: eaf015224cdf2ef94aff17229446c37b57b61323 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
import { useState } from "preact/hooks";
import arrowDown from '../../static/img/chevron-down.svg';
import { ErrorBox } from "./styled";
export function ErrorMessage({ title, description }: { title?: string; description?: string; }) {
const [showErrorDetail, setShowErrorDetail] = useState(false);
if (!title)
return null;
return <ErrorBox>
<div>
<p>{title}</p>
{ description && <button onClick={() => { setShowErrorDetail(v => !v); }}>
<img style={{ height: '1.5em' }} src={arrowDown} />
</button> }
</div>
{showErrorDetail && <p>{description}</p>}
</ErrorBox>;
}
|