-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathZendeskDialog.tsx
More file actions
58 lines (56 loc) · 1.53 KB
/
ZendeskDialog.tsx
File metadata and controls
58 lines (56 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import React from 'react';
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
ScrollArea,
DialogTrigger,
} from '@remoteoss/remote-flows/internals';
import type { ZendeskDrawerComponentProps } from '@remoteoss/remote-flows';
export function ZendeskDialog({
open,
onClose,
data,
isLoading,
error,
zendeskURL,
Trigger,
}: ZendeskDrawerComponentProps) {
const triggerElement = React.isValidElement(Trigger) ? (
Trigger
) : (
<div>{Trigger}</div>
);
return (
<Dialog open={open} onOpenChange={(open) => !open && onClose()}>
<DialogTrigger asChild>{triggerElement}</DialogTrigger>
<DialogContent className='sm:max-w-[920px] max-h-[80vh]'>
<DialogHeader>
<DialogTitle>{data?.title}</DialogTitle>
<DialogDescription>
For more details see our{' '}
<a href={zendeskURL} target='_blank' rel='noopener noreferrer'>
help article
</a>{' '}
</DialogDescription>
</DialogHeader>
<ScrollArea className='h-[60vh] pr-4'>
<div className='space-y-6'>
{isLoading && <div>Loading...</div>}
{error && (
<div className='text-sm text-red-500'>Error loading article</div>
)}
<div
className='flex-1 overflow-y-auto'
dangerouslySetInnerHTML={{
__html: data?.body || '',
}}
></div>
</div>
</ScrollArea>
</DialogContent>
</Dialog>
);
}