-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #429 from yieldprotocol/feat/catchExceptionError
add in an ErrorResponse element
- Loading branch information
Showing
4 changed files
with
87 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { Disclosure } from '@headlessui/react'; | ||
import { | ||
ChevronDownIcon, | ||
ChevronUpIcon, | ||
ExclamationTriangleIcon, | ||
} from '@heroicons/react/24/outline'; | ||
import { Markdown } from '../experimental_/Markdown'; | ||
import { buttonStyle } from '../experimental_/layout/sidebar/NewChatButton'; | ||
import { ResponseTitle, ResponseWrap } from './helpers/layout'; | ||
|
||
const textStyle = 'text-base text-white text-opacity-70 gap-1 '; | ||
|
||
|
||
export interface ErrorResponseProps { | ||
text: string, | ||
error: string, | ||
} | ||
/** | ||
* Error response element | ||
* | ||
* Includes: | ||
* Text | ||
*/ | ||
|
||
export const ErrorResponse = (props: ErrorResponseProps): JSX.Element => { | ||
return ( | ||
<ResponseWrap> | ||
<Disclosure as="div" defaultOpen={false}> | ||
{({ open }) => ( | ||
<> | ||
<Disclosure.Button as="div"> | ||
<ResponseTitle> | ||
<div className="flex items-center gap-4 text-base"> | ||
<div className="w-[16px]"> | ||
<ExclamationTriangleIcon /> | ||
</div> | ||
{props.text} | ||
</div> | ||
<div className="w-[16px]">{open ? <ChevronUpIcon /> : <ChevronDownIcon />}</div> | ||
</ResponseTitle> | ||
</Disclosure.Button> | ||
|
||
<Disclosure.Panel as="div" className={`${textStyle} gap-4`}> | ||
<div className="p-4 font-mono text-xs"> | ||
<Markdown>{props.error}</Markdown> | ||
</div> | ||
<div className="flex w-full justify-center"> | ||
<button className={buttonStyle}> Submit Bug Report </button> | ||
</div> | ||
</Disclosure.Panel> | ||
</> | ||
)} | ||
</Disclosure> | ||
</ResponseWrap> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters