Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1465 | Generic APIPreview component
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Feb 1, 2023
1 parent 45cad3a commit 92d1373
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/components/common/APIPreview.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import React from 'react';
import {
Accordion, AccordionSummary, AccordionDetails, Typography
} from '@mui/material'
import {
ExpandMore as ExpandMoreIcon,
} from '@mui/icons-material'

const APIPreview = ({payload, verb, url, }) => {
return (
<Accordion style={{marginTop: '10px'}}>
<AccordionSummary expandIcon={<ExpandMoreIcon />}>
<Typography>API details</Typography>
</AccordionSummary>
<AccordionDetails>
<div style={{fontWeight: 'bold'}}>
{
`${verb} ${url}`
}
</div>
<div>
<pre style={{color: '#FFF', backgroundColor: 'rgba(0, 0, 0, 0.8)', padding: '10px'}}>
{
JSON.stringify(payload, undefined, 2)
}
</pre>
</div>
</AccordionDetails>
</Accordion>
)
}

export default APIPreview;

0 comments on commit 92d1373

Please sign in to comment.