-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update devbox embedding description + add sandboxes (#217)
* feat: Update devbox embedding description + add sandboxes Embed a devbox in docs, blog posts, Medium, and other websites. Additionally, Devbox embeds still lack some of the customization options that are available in legacy sandbox embeds. * fix: fix typos and improve wording --------- Co-authored-by: Filipe Lima <45261568+filipelima18@users.noreply.github.com>
- Loading branch information
1 parent
82818fa
commit 3f50318
Showing
4 changed files
with
77 additions
and
7 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
74 changes: 74 additions & 0 deletions
74
packages/projects-docs/pages/learn/sandboxes/embedding.mdx
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,74 @@ | ||
--- | ||
title: Embedding | ||
authors: ['CompuIves'] | ||
description: Embed a sandbox in docs, blog posts, Medium, and other websites. | ||
--- | ||
|
||
import { Callout } from 'nextra-theme-docs' | ||
import Video from '../../../../../shared-components/Video' | ||
|
||
# Embedding | ||
|
||
## What is an Embed? | ||
|
||
An embed lets you include a running sandbox in your documentation, blog post, or | ||
website. | ||
|
||
### Embedding Sandboxes | ||
|
||
Sandbox embeds enhance the learning and reading experience for anyone by providing a practical, interactive, and hassle-free way to explore and experiment with code examples. In addition, embeds allow users to interact with code examples directly from an article or blog post, from where users can directly run, modify, and experiment with the code in a live environment. Also, embeds can be a great solution if you want to show examples of applications. | ||
|
||
|
||
<Callout> | ||
Embeds for Sandboxes are currently in beta. | ||
</Callout> | ||
|
||
## Generate an Embed URL | ||
|
||
You can generate a URL to embed by clicking the `Share` button inside the editor of a Sandbox and then clicking on 'Copy embed code'. | ||
|
||
This will give you HTML code with an iFrame that you can paste into your content. | ||
|
||
![Devbox Embed](../images/embed-cloud-sandbox.jpg) | ||
|
||
|
||
## Example Embed | ||
|
||
Below is an example of the iFrame to embed a React sandbox: | ||
|
||
```html | ||
<iframe | ||
style={{ | ||
width: "100%", | ||
height: 900, | ||
outline: "1px solid #252525", | ||
border: 0, | ||
borderRadius: 8, | ||
marginBottom: 16, | ||
zIndex: 100 | ||
}} | ||
src="https://codesandbox.io/p/sandbox/react-new?file=/src/index.js" | ||
></iframe> | ||
``` | ||
|
||
This code outputs the following embed: | ||
|
||
<iframe | ||
style={{ | ||
width: "100%", | ||
height: 900, | ||
outline: "1px solid #252525", | ||
border: 0, | ||
borderRadius: 8, | ||
marginBottom: 16, | ||
zIndex: 100 | ||
}} | ||
src="https://codesandbox.io/p/sandbox/react-new?file=/src/index.js" | ||
></iframe> | ||
|
||
## Limitations | ||
As Sandbox embeds are in beta, some more advanced options are currently unavailable. | ||
|
||
Notably, the embed viewer cannot change the sandbox before forking it, so inline editing is not currently supported on these embeds. | ||
|
||
Additionally, Sandbox embeds still lack some of the customization options available in legacy sandbox embeds. |
3f50318
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
projects-docs – ./
projects-docs-codesandbox1.vercel.app
projects-docs.vercel.app
docs-vercel.codesandbox.io
projects-docs-git-main-codesandbox1.vercel.app