Files
cadhub/web/src/components/IdeViewer/IdeViewer.js
Kurt Hutten 63c2a79a5d Create and deploy simple openscad api
A minimal frontend integration has been added to as a POC

resolves #219 and #222
2021-03-07 17:32:18 +11:00

28 lines
725 B
JavaScript

import { useContext } from 'react'
import { IdeContext } from 'src/components/IdeToolbarNew'
const IdeViewer = () => {
const { state } = useContext(IdeContext)
const image =
state.objectData?.type === 'png' &&
state.objectData?.data &&
window.URL.createObjectURL(state.objectData?.data)
return (
<div className="p-8 border-2 m-2">
<div className="pb-4">hi I'm viewer</div>
<div>
I should be showing an{' '}
<span className="font-mono uppercase">{state.objectData?.type}</span>{' '}
right now with the data{' '}
</div>
{image && (
<div>
<img src={image} className="" />
</div>
)}
</div>
)
}
export default IdeViewer