diff --git a/examples/with-stitches-styled/.gitignore b/examples/with-stitches-styled/.gitignore deleted file mode 100644 index 1437c53f70bc2..0000000000000 --- a/examples/with-stitches-styled/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# production -/build - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env.local -.env.development.local -.env.test.local -.env.production.local - -# vercel -.vercel diff --git a/examples/with-stitches-styled/README.md b/examples/with-stitches-styled/README.md deleted file mode 100644 index 038bf0e3c25e2..0000000000000 --- a/examples/with-stitches-styled/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Stitches (Styled) Example - -This example shows how to use the [Stitches CSS-in-JS Library](https://github.com/christianalfoni/stitches). - -## Deploy your own - -Deploy the example using [Vercel](https://vercel.com): - -[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/with-stitches-styled) - -## How to use - -Execute [Create Next App](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example: - -```bash -npx create-next-app --example with-stitches-styled -# or -yarn create next-app --example with-stitches-styled -``` - -Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). diff --git a/examples/with-stitches-styled/css/index.js b/examples/with-stitches-styled/css/index.js deleted file mode 100644 index 82ca04e9d4b7b..0000000000000 --- a/examples/with-stitches-styled/css/index.js +++ /dev/null @@ -1,12 +0,0 @@ -import { createCss } from '@stitches/css' -import { createStyled } from '@stitches/styled' - -export const css = createCss({ - tokens: { - colors: { - RED: 'tomato', - }, - }, -}) - -export const styled = createStyled(css) diff --git a/examples/with-stitches-styled/package.json b/examples/with-stitches-styled/package.json deleted file mode 100644 index a8b9179cb9ecb..0000000000000 --- a/examples/with-stitches-styled/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "with-stitches-styled", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start" - }, - "dependencies": { - "@stitches/css": "3.0.3", - "@stitches/styled": "3.0.3", - "next": "9.3.5", - "react": "16.13.1", - "react-dom": "16.13.1" - }, - "devDependencies": { - "@types/react": "^16.9.34", - "typescript": "^3.8.3" - }, - "license": "MIT" -} diff --git a/examples/with-stitches-styled/pages/index.js b/examples/with-stitches-styled/pages/index.js deleted file mode 100644 index 46a2e51a0daf8..0000000000000 --- a/examples/with-stitches-styled/pages/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import { styled } from '../css' - -const Header = styled.h1({ - color: 'RED', -}) - -export default function Home() { - return
Hello world
-} diff --git a/examples/with-stitches-styled/public/favicon.ico b/examples/with-stitches-styled/public/favicon.ico deleted file mode 100644 index 4965832f2c9b0..0000000000000 Binary files a/examples/with-stitches-styled/public/favicon.ico and /dev/null differ diff --git a/examples/with-stitches-styled/public/zeit.svg b/examples/with-stitches-styled/public/zeit.svg deleted file mode 100644 index dd3916c5f0499..0000000000000 --- a/examples/with-stitches-styled/public/zeit.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/examples/with-stitches/README.md b/examples/with-stitches/README.md index 11cccb5205f05..ff062046b175a 100644 --- a/examples/with-stitches/README.md +++ b/examples/with-stitches/README.md @@ -1,6 +1,6 @@ # Stitches Example -This example shows how to use the [Stitches CSS-in-JS Library](https://github.com/christianalfoni/stitches). +This example shows how to use the [Stitches CSS-in-JS Library](https://github.com/modulz/stitches). ## Deploy your own diff --git a/examples/with-stitches/components/StitchesLogo.tsx b/examples/with-stitches/components/StitchesLogo.tsx new file mode 100644 index 0000000000000..a08496120e827 --- /dev/null +++ b/examples/with-stitches/components/StitchesLogo.tsx @@ -0,0 +1,50 @@ +const StitchesLogo = () => ( + + + + + + + + + + +) + +export default StitchesLogo diff --git a/examples/with-stitches/css/index.js b/examples/with-stitches/css/index.js deleted file mode 100644 index bf4ac7ac1acae..0000000000000 --- a/examples/with-stitches/css/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import { createCss } from '@stitches/css' - -export const css = createCss({ - tokens: { - colors: { - RED: 'tomato', - }, - }, -}) diff --git a/examples/with-stitches/next-env.d.ts b/examples/with-stitches/next-env.d.ts new file mode 100644 index 0000000000000..7b7aa2c7727d8 --- /dev/null +++ b/examples/with-stitches/next-env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/examples/with-stitches/package.json b/examples/with-stitches/package.json index 289bd02d642a5..819de9b6d10f7 100644 --- a/examples/with-stitches/package.json +++ b/examples/with-stitches/package.json @@ -1,21 +1,20 @@ { - "name": "stitches", + "name": "with-stitches", "version": "0.1.0", - "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start" }, "dependencies": { - "@stitches/css": "3.0.2", - "next": "9.3.5", - "react": "16.13.1", - "react-dom": "16.13.1" + "@stitches/react": "0.0.1", + "next": "latest", + "react": "^16.13.1", + "react-dom": "^16.13.1" }, "devDependencies": { - "@types/react": "^16.9.34", - "typescript": "^3.8.3" + "@types/react": "^16.9.43", + "typescript": "^3.9.7" }, "license": "MIT" } diff --git a/examples/with-stitches/pages/_document.js b/examples/with-stitches/pages/_document.js deleted file mode 100644 index 1cb439e124edb..0000000000000 --- a/examples/with-stitches/pages/_document.js +++ /dev/null @@ -1,32 +0,0 @@ -import Document from 'next/document' -import { css } from '../css' - -export default class MyDocument extends Document { - static async getInitialProps(ctx) { - const originalRenderPage = ctx.renderPage - - try { - let extractedStyles - ctx.renderPage = () => { - const { styles, result } = css.getStyles(originalRenderPage) - extractedStyles = styles - return result - } - - const initialProps = await Document.getInitialProps(ctx) - - return { - ...initialProps, - styles: ( - <> - {initialProps.styles} - {extractedStyles.map((content, index) => ( - - ))} - - ), - } - } finally { - } - } -} diff --git a/examples/with-stitches-styled/pages/_document.js b/examples/with-stitches/pages/_document.tsx similarity index 52% rename from examples/with-stitches-styled/pages/_document.js rename to examples/with-stitches/pages/_document.tsx index 1cb439e124edb..499e3ec607e63 100644 --- a/examples/with-stitches-styled/pages/_document.js +++ b/examples/with-stitches/pages/_document.tsx @@ -1,8 +1,9 @@ -import Document from 'next/document' -import { css } from '../css' +import React from 'react' +import NextDocument, { DocumentContext } from 'next/document' +import { css } from '../stitches.config' -export default class MyDocument extends Document { - static async getInitialProps(ctx) { +export default class Document extends NextDocument { + static async getInitialProps(ctx: DocumentContext) { const originalRenderPage = ctx.renderPage try { @@ -13,15 +14,19 @@ export default class MyDocument extends Document { return result } - const initialProps = await Document.getInitialProps(ctx) + const initialProps = await NextDocument.getInitialProps(ctx) return { ...initialProps, styles: ( <> {initialProps.styles} + {extractedStyles.map((content, index) => ( - +