Skip to content

Commit

Permalink
chore: go back to basics
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaellis committed May 11, 2024
1 parent ef2d8b3 commit 6bef59f
Show file tree
Hide file tree
Showing 167 changed files with 682 additions and 3,824 deletions.
File renamed without changes.
4 changes: 4 additions & 0 deletions docs-old/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": ["react-spring"]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 31 additions & 0 deletions docs-old/app/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { RemixBrowser } from '@remix-run/react'
import * as React from 'react'
import { hydrateRoot } from 'react-dom/client'

import { ClientStyleContext } from '~/styles/client.context'
import { getCssText } from '~/styles/stitches.config'

interface ClientCacheProviderProps {
children: React.ReactNode
}

function ClientCacheProvider({ children }: ClientCacheProviderProps) {
const [sheet, setSheet] = React.useState(getCssText())

const reset = React.useCallback(() => {
setSheet(getCssText())
}, [])

return (
<ClientStyleContext.Provider value={{ reset, sheet }}>
{children}
</ClientStyleContext.Provider>
)
}

hydrateRoot(
document,
<ClientCacheProvider>
<RemixBrowser />
</ClientCacheProvider>
)
28 changes: 28 additions & 0 deletions docs-old/app/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { renderToString } from 'react-dom/server'
import type { EntryContext } from '@vercel/remix'
import { RemixServer } from '@remix-run/react'

import { getCssText } from './styles/stitches.config'

export default function handleRequest(
request: Request,
responseStatusCode: number,
responseHeaders: Headers,
remixContext: EntryContext
) {
let markup = renderToString(
<RemixServer context={remixContext} url={request.url} />
)

markup = markup.replace(
/<style id="stitches">.*<\/style>/g,
`<style id="stitches">${getCssText()}</style>`
)

responseHeaders.set('Content-Type', 'text/html')

return new Response('<!DOCTYPE html>' + markup, {
status: responseStatusCode,
headers: responseHeaders,
})
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
133 changes: 133 additions & 0 deletions docs-old/app/root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
import * as React from 'react'

import {
MetaFunction,
LinksFunction,
LoaderFunction,
json,
} from '@vercel/remix'
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
useLoaderData,
} from '@remix-run/react'
import docusearch from '@docsearch/css/dist/style.css?url'

import { globalStyles } from './styles/global'

import { WidgetTheme } from './components/Widgets/WidgetTheme'
import { WidgetPlausible } from './components/Widgets/WidgetPlausible'
import { SiteFooter } from './components/Site/SiteFooter'
import { ClientStyleContext } from './styles/client.context'

export const meta: MetaFunction = () => {
return [
{ title: 'react-spring' },
{
name: 'description',
content:
'Bring your components to life with simple spring animation primitives for React',
},
{ property: 'og:site_name', content: 'React Spring' },
{ property: 'og:title', content: 'React Spring' },
{
property: 'og:description',
content:
'Bring your components to life with simple spring animation primitives for React',
},
{ property: 'og:image', content: 'https://www.react-spring.dev/share.jpg' },
{ property: 'og:type', content: 'website' },
{ property: 'og:image:width', content: '1200' },
{ property: 'og:image:height', content: '630' },
{ property: 'og:url', content: 'https://www.react-spring.dev' },
{ property: 'twitter:card', content: 'summary_large_image' },
{ property: 'twitter:domain', content: 'react-spring.dev' },
{ property: 'twitter:url', content: 'https://www.react-spring.dev' },
{ property: 'twitter:title', content: 'React Spring' },
{
property: 'twitter:description',
content:
'Bring your components to life with simple spring animation primitives for React',
},
{
property: 'twitter:image',
content: 'https://www.react-spring.dev/share.jpg',
},
]
}

export const links: LinksFunction = () => [
{ rel: 'stylesheet', href: docusearch },
{ rel: 'stylesheet', href: 'https://rsms.me/inter/inter.css' },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{ rel: 'preconnect', href: 'https://fonts.gstatic.com' },
{
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap',
},
]

export const loader: LoaderFunction = () => {
return json({
ENV: {
ENABLE_PLAUSIBLE: process.env.ENABLE_PLAUSIBLE,
ALGOLIA_APP_ID: process.env.ALGOLIA_APP_ID,
ALGOLIA_API_KEY: process.env.ALGOLIA_API_KEY,
ENABLE_CARBON: process.env.ENABLE_CARBON,
},
})
}

function Document({ children }: { children: React.ReactNode }) {
globalStyles()

const clientStyleData = React.useContext(ClientStyleContext)

// Only executed on client
React.useEffect(() => {
// reset cache to re-apply global styles
clientStyleData.reset()
}, [clientStyleData])

const data = useLoaderData<{ ENV: object }>()

return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<Meta />
<Links />
<style
id="stitches"
dangerouslySetInnerHTML={{ __html: clientStyleData.sheet }}
suppressHydrationWarning
/>
<WidgetPlausible />
{/* <WidgetTheme /> */}
</head>
<body>
{children}
<SiteFooter />
<script
dangerouslySetInnerHTML={{
__html: `window.env = ${JSON.stringify(data.ENV)}`,
}}
/>
<Scripts />
</body>
</html>
)
}

export default function App() {
return (
<Document>
<Outlet />
<ScrollRestoration />
</Document>
)
}
2 changes: 1 addition & 1 deletion docs/app/routes/$.tsx → docs-old/app/routes/$.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { json, LoaderFunction, MetaFunction, redirect } from '@remix-run/node'
import { json, LoaderFunction, MetaFunction, redirect } from '@vercel/remix'
import { GradientButton } from '~/components/Buttons/GradientButton'

import { Header } from '~/components/Header/Header'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionFunction, json } from '@remix-run/node'
import { ActionFunction, json } from '@vercel/remix'
import { createClient } from '@supabase/supabase-js'
import z from 'zod'

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
LoaderFunction,
MetaFunction,
redirect,
} from '@remix-run/node'
} from '@vercel/remix'
import {
useLoaderData,
Form,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MetaFunction } from '@remix-run/node'
import { MetaFunction } from '@vercel/remix'
import { CarouselQuotes } from '~/components/Carousels/CarouselQuotes'
import { NavigationGrid } from '~/components/Grids/NavigationGrid'
import { Header } from '~/components/Header/Header'
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
65 changes: 65 additions & 0 deletions docs-old/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"name": "@react-spring/docs",
"license": "MIT",
"author": "Josh Ellis",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "vite build && vite build --ssr",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf .cache && rm -rf api",
"dev": "concurrently \"yarn dev:remix\" \"yarn scripts:watch\"",
"dev:remix": "vite dev",
"lint": "TIMING=1 eslint \"app/**/*.ts*\" \"scripts/**/*.ts*\"",
"scripts:build": "ts-node ./scripts/build.ts",
"scripts:watch": "ts-node ./scripts/watch.ts"
},
"dependencies": {
"@codesandbox/sandpack-react": "^1.20.9",
"@docsearch/react": "^3.5.2",
"@mdx-js/react": "^3.0.1",
"@mdx-js/rollup": "^3.0.1",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-toolbar": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.7",
"@react-spring/rafz": "workspace:^",
"@react-spring/web": "9.7.3",
"@remix-run/node": "^2.9.2",
"@remix-run/react": "^2.9.2",
"@remix-run/serve": "^2.9.2",
"@stitches/react": "^1.2.8",
"@supabase/supabase-js": "^2.39.3",
"@use-gesture/react": "^10.2.24",
"gray-matter": "^4.0.3",
"hast-util-to-html": "7.1.3",
"jotai": "^2.0.3",
"parse-numeric-range": "^1.3.0",
"phosphor-react": "^1.4.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-select": "^5.7.0",
"react-use-measure": "^2.1.1",
"refractor": "4.8.1",
"rehype-autolink-headings": "7.1.0",
"rehype-parse": "9.0.0",
"rehype-slug": "6.0.0",
"remark-directive": "3.0.0",
"remix": "^2.9.2",
"unified": "11.0.4",
"unist-util-visit": "5.0.0",
"vite": "^5.2.11",
"zod": "^3.21.4"
},
"devDependencies": {
"@remix-run/v1-route-convention": "^0.1.4",
"@vercel/remix": "^2.9.2-patch.2",
"chokidar": "^3.5.3",
"concurrently": "^8.2.2",
"remark-frontmatter": "^5.0.0",
"remark-mdx-frontmatter": "^4.0.0",
"ts-node": "^10.9.2",
"vite-tsconfig-paths": "^4.3.2"
},
"sideEffects": false
}
File renamed without changes
File renamed without changes
Binary file added docs-old/public/favicon.ico
Binary file not shown.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions docs-old/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"include": [
"env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.js",
"*.d.ts",
"vite.config.ts"
],
"exclude": ["build"],
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"target": "ESNext",
"strict": true,
"paths": {
"~/*": ["./app/*"]
},
"noEmit": true,
"baseUrl": ".",
"allowJs": true,
"forceConsistentCasingInFileNames": true
}
}
File renamed without changes.
11 changes: 11 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules

.cache
.env
.vercel
.output

build
public/build
api/index.js*
api/_assets*
34 changes: 34 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Welcome to Remix!

- [Remix Docs](https://remix.run/docs)

## Deployment

After having run the `create-remix` command and selected "Vercel" as a deployment target, you only need to [import your Git repository](https://vercel.com/new) into Vercel, and it will be deployed.

If you'd like to avoid using a Git repository, you can also deploy the directory by running [Vercel CLI](https://vercel.com/cli):

```sh
npm i -g vercel
vercel
```

It is generally recommended to use a Git repository, because future commits will then automatically be deployed by Vercel, through its [Git Integration](https://vercel.com/docs/concepts/git).

## Development

To run your Remix app locally, make sure your project's local dependencies are installed:

```sh
npm install
```

Afterwards, start the Remix development server like so:

```sh
npm run dev
```

Open up [http://localhost:3000](http://localhost:3000) and you should be ready to go!

If you're used to using the `vercel dev` command provided by [Vercel CLI](https://vercel.com/cli) instead, you can also use that, but it's not needed.
Loading

0 comments on commit 6bef59f

Please sign in to comment.