Skip to content

Commit

Permalink
Fixes for embeded renderer (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
JayaKrishnaNamburu authored Mar 18, 2021
1 parent 400077e commit d7dc6d9
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
49 changes: 39 additions & 10 deletions pages/embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
import { SandpackFiles } from '@codesandbox/sandpack-react'
import { generate } from '../utils/helper'
import BrowserPreview from '../components/BrowserPreview'
import { AppPage } from '../components/AppPage'

const Embed = () => {
const [files, setFiles] = useState<SandpackFiles>({})
Expand All @@ -27,16 +28,44 @@ const Embed = () => {
}, [])

return (
<div className="preview">
<BrowserPreview
options={{ files, displayFiles: false, theme: 'codesandbox-light' }}
/>
<style jsx>{`
.preview {
height: calc(100vh - 15px);
}
`}</style>
</div>
<AppPage>
<div className="preview">
{Object.keys(files || {}).length > 0 && (
<BrowserPreview
options={{ files, displayFiles: false, theme: 'codesandbox-light' }}
/>
)}
{Object.keys(files || {}).length === 0 && (
<div className="empty_state">
<img className="logo" src="/static/svg/logo_white.svg" alt="Teleport HQ" />
Listening for updates
</div>
)}
<style jsx>{`
.empty_state {
height: 100%;
display: flex;
align-items: center;
background-size: cover;
justify-content: center;
flex-direction: column;
color: var(--main-text-color);
font-family: var(--main-font-family);
font-size: var(--main-text-font-size);
background-image: url('/static/svg/hero.svg');
}
.logo {
width: 200px;
padding-bottom: 10px;
}
.preview {
height: 100vh;
}
`}</style>
</div>
</AppPage>
)
}

Expand Down
1 change: 1 addition & 0 deletions public/static/svg/hero.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/static/svg/logo_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit d7dc6d9

@vercel
Copy link

@vercel vercel bot commented on d7dc6d9 Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.