-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
166 additions
and
62 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { marked } from 'marked'; | ||
|
||
export const Bot = ({ data }: { data: string }) => { | ||
const [html, setHtml] = useState<string>(''); | ||
useEffect(() => { | ||
const renderedHtml = marked.parse(data, { async: false }); | ||
setHtml(() => renderedHtml); | ||
}, [data]); | ||
return ( | ||
<div | ||
style={{ | ||
width: '80%', | ||
color: 'var(--vscode-foreground)', | ||
textAlign: 'left', | ||
marginBottom: '1rem', | ||
}} | ||
dangerouslySetInnerHTML={{ __html: html }} | ||
/> | ||
); | ||
}; |
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,40 @@ | ||
export const User = ({ data }: { data: string }) => { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
justifyContent: 'flex-end', | ||
marginBottom: '1rem', | ||
}} | ||
> | ||
<div | ||
style={{ | ||
maxWidth: '80%', | ||
backgroundColor: 'var(--vscode-input-background)', | ||
color: 'var(--vscode-foreground)', | ||
padding: '10px 15px', | ||
borderRadius: '15px', | ||
textAlign: 'left', | ||
position: 'relative', | ||
boxShadow: '0px 2px 5px rgba(0, 0, 0, 0.2)', | ||
}} | ||
> | ||
{data} | ||
<div | ||
style={{ | ||
content: '""', | ||
position: 'absolute', | ||
bottom: '10px', | ||
right: '-10px', | ||
width: '0', | ||
height: '0', | ||
borderTop: '10px solid var(--vscode-input-background)', | ||
borderLeft: '10px solid transparent', | ||
borderRight: 'none', | ||
borderBottom: 'none', | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; |
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