Skip to content

Commit

Permalink
Remove playroom
Browse files Browse the repository at this point in the history
  • Loading branch information
talentlessguy committed Dec 2, 2024
1 parent 1d93468 commit f14b6a0
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 4,327 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ yarn-error.log*

docs/.next/
docs/out/
docs/public/playroom/
# Do not delete. This is a dummy file to ensure that cloudflare does not serve the original playroom index file.
!docs/public/playroom/index.html
docs/src/playroom/snippets

components/dist/
components/coverage/
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
docs/.next/
docs/public/playroom/
docs/out

components/dist/
Expand Down
30 changes: 0 additions & 30 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,6 @@ const config = {
},
],
},
async rewrites() {
// Rewrite playroom urls for production
// if (process.env.NODE_ENV === 'production')
// return [
// {
// source: '/playroom/preview',
// destination: '/playroom/preview/index.html',
// },
// {
// source: '/playroom/frame.html',
// destination: '/playroom/frame.html',
// },
// {
// source: '/playroom',
// destination: '/playroom/index.html',
// },
// ]
return []
},
async redirects() {
if (process.env.NODE_ENV === 'production') return []
// Redirect playroom to local dev server in development
return [
{
source: '/playroom',
destination: 'http://localhost:8082',
permanent: false,
},
]
},
pageExtensions: ['mdx', 'tsx'],
webpack(config) {
config.resolve.alias['@ensdomains/thorin'] = path.resolve(
Expand Down
7 changes: 2 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"scripts": {
"build": "next build",
"build:next": "next build",
"clean": "rm -rf .next public/playroom",
"dev": "NODE_OPTIONS='--inspect' next dev & playroom start",
"clean": "rm -rf .next",
"dev": "NODE_OPTIONS='--inspect' next dev",
"start": "next start"
},
"dependencies": {
Expand Down Expand Up @@ -42,11 +42,8 @@
"@types/react-dom": "^18.2.13",
"@types/webpack-env": "^1.18.5",
"@vanilla-extract/css": "^1.13.0",
"babel-loader": "^8.2.4",
"css-loader": "^6.8.1",
"mini-css-extract-plugin": "^2.7.6",
"react-docgen-typescript": "^2.1.1",
"style-loader": "^3.3.3",
"typescript": "^5.7.2"
}
}
69 changes: 0 additions & 69 deletions docs/playroom.config.cjs

This file was deleted.

17 changes: 7 additions & 10 deletions docs/src/components/CodeBlock/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import vsDark from 'prism-react-renderer/themes/vsDark'
import type { Colors } from '@ensdomains/thorin'

import { useIsMounted } from '~/utils/isMounted'
import { PlayroomStateProvider } from '~/playroom/PlayroomState'

import { CopyButton } from '../CopyButton'
import type { Props as CodePreviewProps } from '../CodePreview'
Expand Down Expand Up @@ -79,15 +78,13 @@ export const CodeBlock = ({
if (!isMounted) return null
if (live)
return (
<PlayroomStateProvider>
<CodePreview
// backgroundColor={backgroundColor}
code={code}
expand={expand}
minHeight={minHeight}
theme={prismTheme}
/>
</PlayroomStateProvider>
<CodePreview
// backgroundColor={backgroundColor}
code={code}
expand={expand}
minHeight={minHeight}
theme={prismTheme}
/>
)

const language = className?.replace(/language-/, '') as Language
Expand Down
25 changes: 1 addition & 24 deletions docs/src/components/CodePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,10 @@ import type { Colors } from '@ensdomains/thorin'
import { Button, UpChevronSVG } from '@ensdomains/thorin'
import * as Components from '@ensdomains/thorin'

import { createPlayroomLink } from '~/utils/playroom'
import { usePlayroomStore } from '~/playroom/PlayroomState'
import { avatars } from '~/playroom/useScope'

import { Prism } from './Prism'
import ComponentWrapper from '../playroom/ComponentWrapper'
import { CopyButton } from './CopyButton'
import type { BoxProps } from '@ensdomains/thorin'
import { Box, DownChevronSVG, OutlinkSVG } from '@ensdomains/thorin'
import { Box, DownChevronSVG } from '@ensdomains/thorin'

export type Props = {
backgroundColor?: Colors
Expand Down Expand Up @@ -94,7 +89,6 @@ export const CodePreview = ({
React.useEffect(() => {
if (_code && _code !== code) setCode(_code)
}, [_code])
const store = usePlayroomStore()

return (
<LiveProvider
Expand All @@ -103,12 +97,9 @@ export const CodePreview = ({
scope={{
mdx,
...Components,
ComponentWrapper,
...store,
previewRef,
NextImage,
NextLink,
avatars,
}}
theme={theme}
transformCode={code => '/** @jsx mdx */' + code}
Expand Down Expand Up @@ -156,20 +147,6 @@ export const CodePreview = ({
{state.expand ? 'Collapse Code' : 'Expand Code'}
</Button>
</div>

<div>
<Button
as="a"
colorStyle="transparent"
color="blue"
prefix={OutlinkSVG}
href={createPlayroomLink({ code })}
size="small"
target="_blank"
>
Playroom
</Button>
</div>
</Box>
</LiveProvider>
)
Expand Down
7 changes: 0 additions & 7 deletions docs/src/components/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,6 @@ export const SideBar = ({ open, links }: { open: boolean, links: Links }) => {
>
Development
</NavLink>
<NavLink
href="/guides/playroom"
active={router.asPath === '/guides/playroom'}
target="_blank"
>
Playroom
</NavLink>
<NavLink href="/" active={router.asPath === '/'}>
Design
</NavLink>
Expand Down
6 changes: 3 additions & 3 deletions docs/src/guides/development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Guidelines for working on thorin

## Set Up

Clone repository, install dependencies, and run the dev script to start the docs and playroom sites.
Clone repository, install dependencies, and run the dev script to start the docs.

```bash
gh repo clone @ensdomains/thorin
Expand Down Expand Up @@ -147,11 +147,11 @@ yarn build

## Common Issues

### My component did not update in my mdx file or playroom.?
### My component did not update in my mdx file?

Update the component using `yarn build:component` and reload the page after the script has completed.

### My snippet looks malformed or doesn't work in playroom
### My snippet looks malformed

Check if displayName has been added to component. If not, then you may need to conver the snippet to a string. See the [snippets section](#snippets) for more details.

Expand Down
Loading

0 comments on commit f14b6a0

Please sign in to comment.