-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added conversation functionality including codeblocks and images
- Loading branch information
Bianca Wentzel
committed
Aug 30, 2024
1 parent
f092315
commit 604cf5c
Showing
2 changed files
with
175 additions
and
19 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,41 @@ | ||
import React from 'react'; | ||
|
||
import PropTypes from "prop-types"; | ||
|
||
const CodeBlockStyle = { | ||
block: { | ||
backgroundColor: "#444", | ||
borderRadius: "5px", | ||
borderTop: "20px solid #666", | ||
padding: "5px 5px 5px 15px", | ||
color: "lightgray", | ||
fontWeight: "bold", | ||
fontFamily: "Consolas", | ||
marginBottom: "10px" | ||
}, | ||
blockLanguage: { | ||
backgroundColor: "lightgrey", | ||
}, | ||
codeLine: { | ||
margin: "0px", | ||
} | ||
} | ||
|
||
function formatCode(codeString) { | ||
const seperatedCode = codeString.split("\\n"); | ||
return seperatedCode; | ||
} | ||
|
||
function CodeBlock(props) { | ||
return( | ||
<div style={CodeBlockStyle.block}> | ||
{formatCode(props.code).map((element, index) => {return <p style={CodeBlockStyle.codeLine} key={index}>{element}</p>})} | ||
</div> | ||
); | ||
} | ||
|
||
CodeBlock.propTypes = { | ||
code: PropTypes.string, | ||
} | ||
|
||
export default CodeBlock; |
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