Skip to content

Commit

Permalink
chore: bump sandpack
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaellis committed Jun 29, 2022
1 parent 52d745e commit a3f1587
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 89 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
76 changes: 42 additions & 34 deletions docs/app/components/Code/LivePreview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useRef, useState } from 'react'
import { SandpackRunner } from '@codesandbox/sandpack-react'
import { SandpackPreview, SandpackProvider } from '@codesandbox/sandpack-react'
import * as Accordion from '@radix-ui/react-accordion'
import { animated, useSpring } from '@react-spring/web'

Expand Down Expand Up @@ -44,6 +44,9 @@ export const LivePreview = ({
[]
)

/**
* TODO: make this instant on initial mount
*/
useEffect(() => {
api.start({
height: value === '' ? 0 : preRef.current.getBoundingClientRect().height,
Expand All @@ -52,40 +55,42 @@ export const LivePreview = ({

return (
<PreviewContainer className={className}>
<SandpackRunner
code={template}
<SandpackProvider
template="react"
customSetup={{
files: {
'/index.css': {
code: /* css */ `
html, body {
height: 100%;
}
body {
display:flex;
align-items: center;
margin: 0 25px;
}
.spring-box {
width: 80px;
height: 80px;
background-color: #ff6d6d;
border-radius: 8px;
font-family: Helvetica;
font-size: 14px;
display: flex;
justify-content: center;
align-items: center;
color: #1B1A22;
}
`,
},
files={{
'/App.js': {
code: template,
},
'/index.css': {
code: /* css */ `
html, body {
height: 100%;
}
body {
display:flex;
align-items: center;
margin: 0 25px;
}
.spring-box {
width: 80px;
height: 80px;
background-color: #ff6d6d;
border-radius: 8px;
font-family: Helvetica;
font-size: 14px;
display: flex;
justify-content: center;
align-items: center;
color: #1B1A22;
}
`,
},
}}
customSetup={{
dependencies: {
'@react-spring/web': '9.4.0-beta.1',
'@react-spring/web': '*',
},
}}
options={{
Expand All @@ -99,8 +104,9 @@ export const LivePreview = ({
'sp-overlay': 'preview__overlay',
'sp-button': 'preview__button',
},
}}
/>
}}>
<SandpackPreview />
</SandpackProvider>
{showCode ? (
<Accordion.Root
type="single"
Expand Down Expand Up @@ -144,6 +150,7 @@ const PreviewContainer = styled('div', {

'& .preview__container': {
position: 'relative',
backgroundColor: 'transparent',
},

'& .preview__actions': {
Expand Down Expand Up @@ -174,6 +181,7 @@ const PreviewContainer = styled('div', {

hover: {
backgroundColor: '$steel20',
color: '$black !important',
},
},

Expand Down
1 change: 0 additions & 1 deletion docs/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
json,
useLoaderData,
} from 'remix'

import docusearch from '@docsearch/css/dist/style.css'

import { globalStyles } from './styles/global'
Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts:watch": "ts-node ./scripts/watch.ts"
},
"dependencies": {
"@codesandbox/sandpack-react": "^0.14.9",
"@codesandbox/sandpack-react": "^1.2.2",
"@docsearch/react": "^3.1.0",
"@mdx-js/react": "^1.6.22",
"@radix-ui/react-accordion": "^0.1.6",
Expand Down
75 changes: 22 additions & 53 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3617,19 +3617,19 @@ __metadata:
languageName: node
linkType: hard

"@codesandbox/sandpack-client@npm:^0.14.8":
version: 0.14.8
resolution: "@codesandbox/sandpack-client@npm:0.14.8"
"@codesandbox/sandpack-client@npm:^1.2.2":
version: 1.2.2
resolution: "@codesandbox/sandpack-client@npm:1.2.2"
dependencies:
codesandbox-import-utils: ^1.2.3
lodash.isequal: ^4.5.0
checksum: 9c97615018ce25d93891b1a0458cfef99808725827ccabb09f86d2267b9c73c1b77c5deb26c589128669520dc213eae8f77720c5e758e4cb22dc5a230a606c78
checksum: c43d3829007c82984d3a404e4f507f682edf6d54817a3e488dec9d2c93e740f1fbf9b3ae2785004049cf4fd88e773398f7ad16015ce48c69368f244195f4721a
languageName: node
linkType: hard

"@codesandbox/sandpack-react@npm:^0.14.9":
version: 0.14.9
resolution: "@codesandbox/sandpack-react@npm:0.14.9"
"@codesandbox/sandpack-react@npm:^1.2.2":
version: 1.2.2
resolution: "@codesandbox/sandpack-react@npm:1.2.2"
dependencies:
"@code-hike/classer": ^0.0.0-aa6efee
"@codemirror/closebrackets": ^0.19.0
Expand All @@ -3645,17 +3645,18 @@ __metadata:
"@codemirror/matchbrackets": ^0.19.3
"@codemirror/state": ^0.19.6
"@codemirror/view": ^0.19.32
"@codesandbox/sandpack-client": ^0.14.8
"@codesandbox/sandpack-client": ^1.2.2
"@react-hook/intersection-observer": ^3.1.1
"@stitches/core": ^1.2.6
codesandbox-import-util-types: ^2.2.3
codesandbox-import-utils: ^2.2.3
lodash.isequal: ^4.5.0
lz-string: ^1.4.4
react-devtools-inline: 4.4.0
react-is: ^17.0.2
peerDependencies:
react: ^16.8.0 || ^17
react-dom: ^16.8.0 || ^17
checksum: 18153026275f484d01981a41ab4411a06c6fc1ede30d2ce8af5b4d700fa1306e5195b3258a74315b581a2dc32fe1ec11a9bb76252915f3f55996f046085570e5
checksum: a5ea5dcff18659be4459ad74b4d219ae329af702a5af545f6d7d668dd2960245c5f914b53023e79d9494151f19a4b44787d298f1171822972f09f0c6a5ea74e6
languageName: node
linkType: hard

Expand Down Expand Up @@ -5295,7 +5296,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@react-spring/docs@workspace:docs"
dependencies:
"@codesandbox/sandpack-react": ^0.14.9
"@codesandbox/sandpack-react": ^1.2.2
"@docsearch/react": ^3.1.0
"@mdx-js/react": ^1.6.22
"@radix-ui/react-accordion": ^0.1.6
Expand Down Expand Up @@ -5896,6 +5897,13 @@ __metadata:
languageName: node
linkType: hard

"@stitches/core@npm:^1.2.6":
version: 1.2.8
resolution: "@stitches/core@npm:1.2.8"
checksum: 3a76a697b1d71ffb212e8b166f923c8f66ef99de93689dd417571f90fbba5692abb9a92220acd102baf5298896f0fdfeaa721da2d61adee1247531a26f67a15f
languageName: node
linkType: hard

"@stitches/react@npm:^1.2.8":
version: 1.2.8
resolution: "@stitches/react@npm:1.2.8"
Expand Down Expand Up @@ -7748,7 +7756,7 @@ __metadata:
languageName: node
linkType: hard

"binaryextensions@npm:2, binaryextensions@npm:^2.1.2":
"binaryextensions@npm:2":
version: 2.3.0
resolution: "binaryextensions@npm:2.3.0"
checksum: e64e4658a611a753e0320b047a0045a063c6f2dd92d7a7fc06c25f7e72fb3700dabcf328e319c79f1038e6d0ea46edb0644686603d5f36bff3350d0e7eb198a9
Expand Down Expand Up @@ -8528,7 +8536,7 @@ __metadata:
languageName: node
linkType: hard

"codesandbox-import-util-types@npm:^2.2.3, codesandbox-import-util-types@npm:^2.3.0":
"codesandbox-import-util-types@npm:^2.2.3":
version: 2.3.0
resolution: "codesandbox-import-util-types@npm:2.3.0"
checksum: e527fe1a0bc2de5a0a9842a70d42ad4c6de56a99a4a9e1427a81f4006ab91d85ff098e2e919cccbcd8703f9b3216b9c1f4ce5a40261051d8d1511287fbbf7d77
Expand All @@ -8546,17 +8554,6 @@ __metadata:
languageName: node
linkType: hard

"codesandbox-import-utils@npm:^2.2.3":
version: 2.3.0
resolution: "codesandbox-import-utils@npm:2.3.0"
dependencies:
codesandbox-import-util-types: ^2.3.0
istextorbinary: ^2.2.1
lz-string: ^1.4.4
checksum: 977edf0d95706bf02e0b850679efb84ab04fa2d92d05faf183626fa996e2ff0c9f1350d69b0a8cf11c519f3edf15266f1109402810d0e6219b08a0b0589b072d
languageName: node
linkType: hard

"collect-v8-coverage@npm:^1.0.0":
version: 1.0.1
resolution: "collect-v8-coverage@npm:1.0.1"
Expand Down Expand Up @@ -9676,16 +9673,6 @@ __metadata:
languageName: node
linkType: hard

"editions@npm:^2.2.0":
version: 2.3.1
resolution: "editions@npm:2.3.1"
dependencies:
errlop: ^2.0.0
semver: ^6.3.0
checksum: 0b08a2b50c30e7b046a3096ee66ea326158a147daac5f8c134b4bdfe4d2fe02f9916c8b92d8e86887f2379c3528df2150cc9eb3d5bc25c442b4b380d6d7a754e
languageName: node
linkType: hard

"ee-first@npm:1.1.1":
version: 1.1.1
resolution: "ee-first@npm:1.1.1"
Expand Down Expand Up @@ -9792,13 +9779,6 @@ __metadata:
languageName: node
linkType: hard

"errlop@npm:^2.0.0":
version: 2.2.0
resolution: "errlop@npm:2.2.0"
checksum: 9bce5eba67866b168cfbc98de46df4d7ad7a8e75fb12a40ade886d801dbe4c9d5d640a0bb6a41552a47aeda00c26db97182732213d7d523439e10dc6a853bd7d
languageName: node
linkType: hard

"error-ex@npm:^1.3.1":
version: 1.3.2
resolution: "error-ex@npm:1.3.2"
Expand Down Expand Up @@ -13306,17 +13286,6 @@ __metadata:
languageName: node
linkType: hard

"istextorbinary@npm:^2.2.1":
version: 2.6.0
resolution: "istextorbinary@npm:2.6.0"
dependencies:
binaryextensions: ^2.1.2
editions: ^2.2.0
textextensions: ^2.5.0
checksum: 964915aa9533df46a7142d36263e9e1a0940d63b58e2ee1ca1ecc9088239a2499b8153d9746225cfe71b9a7a0ab40565bf23c0a8cfed3a4bce7465303b9fb237
languageName: node
linkType: hard

"iterm2-version@npm:^4.1.0":
version: 4.2.0
resolution: "iterm2-version@npm:4.2.0"
Expand Down Expand Up @@ -19736,7 +19705,7 @@ __metadata:
languageName: node
linkType: hard

"textextensions@npm:2, textextensions@npm:^2.5.0":
"textextensions@npm:2":
version: 2.6.0
resolution: "textextensions@npm:2.6.0"
checksum: e28781f092d0172b78974fd22d5c007cc43ac50be666b36bbf10125d961775faf309a70b51697a2debc074c8f23cc923f1386b1e4661e11b128cee292060034c
Expand Down

0 comments on commit a3f1587

Please sign in to comment.