-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
129 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { SandpackTheme } from "./types"; | ||
|
||
export const dracula: SandpackTheme = { | ||
colors: { | ||
surface1: "#282a36", | ||
surface2: "#44475a", | ||
surface3: "#44475a", | ||
clickable: "#6272a4", | ||
base: "#f8f8f2", | ||
disabled: "#6272a4", | ||
hover: "#f8f8f2", | ||
accent: "#bd93f9", | ||
error: "#f8f8f2", | ||
errorSurface: "#44475a", | ||
}, | ||
syntax: { | ||
plain: "#f8f8f2", | ||
comment: { | ||
color: "#6272a4", | ||
fontStyle: "italic", | ||
}, | ||
keyword: "#ff79c6", | ||
tag: "#ff79c6", | ||
punctuation: "#ff79c6", | ||
definition: "#f8f8f2", | ||
property: "#50fa7b", | ||
static: "#bd93f9", | ||
string: "#f1fa8c", | ||
}, | ||
font: { | ||
body: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', | ||
mono: '"Fira Mono", "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", Monaco, "Lucida Console", monospace', | ||
size: "13px", | ||
lineHeight: "20px", | ||
}, | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React, { useState } from "react"; | ||
import * as themes from "@codesandbox/sandpack-themes"; | ||
import { Sandpack } from "@codesandbox/sandpack-react"; | ||
import CodeBlock from "@codesandbox/sandpack-docusaurus/src/theme/CodeBlock"; | ||
|
||
export default () => { | ||
const [current, setCurrent] = useState("githubLight"); | ||
|
||
const codeBlock = `import { ${current} } from "@codesandbox/sandpack-themes"; | ||
<Sandpack theme={${current}} />;`; | ||
|
||
return ( | ||
<div> | ||
<label> | ||
Try out: | ||
<select | ||
style={{ marginLeft: ".5em" }} | ||
defaultValue="githubLight" | ||
onChange={({ target }) => setCurrent(target.value)} | ||
> | ||
{Object.keys(themes).map((themeName) => ( | ||
<option>{themeName}</option> | ||
))} | ||
</select> | ||
</label> | ||
|
||
<br /> | ||
<br /> | ||
|
||
<CodeBlock>{codeBlock}</CodeBlock> | ||
|
||
<Sandpack | ||
options={{ | ||
showLineNumbers: true, | ||
showInlineErrors: true, | ||
showNavigator: true, | ||
showTabs: true, | ||
closableTabs: true, | ||
visibleFiles: [ | ||
"/App.js", | ||
"/index.js", | ||
"/public/index.html", | ||
"/styles.css", | ||
], | ||
}} | ||
template="react" | ||
theme={themes[current]} | ||
/> | ||
</div> | ||
); | ||
}; |