Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with-stitches example #16827

Merged
merged 10 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions examples/with-stitches-styled/.gitignore

This file was deleted.

21 changes: 0 additions & 21 deletions examples/with-stitches-styled/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions examples/with-stitches-styled/css/index.js

This file was deleted.

22 changes: 0 additions & 22 deletions examples/with-stitches-styled/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions examples/with-stitches-styled/pages/index.js

This file was deleted.

Binary file removed examples/with-stitches-styled/public/favicon.ico
Binary file not shown.
10 changes: 0 additions & 10 deletions examples/with-stitches-styled/public/zeit.svg

This file was deleted.

2 changes: 1 addition & 1 deletion examples/with-stitches/README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
9 changes: 0 additions & 9 deletions examples/with-stitches/css/index.js

This file was deleted.

2 changes: 2 additions & 0 deletions examples/with-stitches/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
10 changes: 5 additions & 5 deletions examples/with-stitches/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "stitches",
"name": "with-stitches",
"version": "0.1.0",
"private": true,
"scripts": {
Expand All @@ -8,14 +8,14 @@
"start": "next start"
},
"dependencies": {
"@stitches/css": "3.0.2",
"next": "9.3.5",
"@stitches/react": "0.0.1",
"next": "9.5.1",
"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"
}
32 changes: 0 additions & 32 deletions examples/with-stitches/pages/_document.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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) => (
<style key={index}>{content}</style>
<style
key={index}
dangerouslySetInnerHTML={{ __html: content }}
/>
))}
</>
),
Expand Down
13 changes: 0 additions & 13 deletions examples/with-stitches/pages/index.js

This file was deleted.

101 changes: 101 additions & 0 deletions examples/with-stitches/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import Head from 'next/head'
import { styled } from '../stitches.config'

const Box = styled('div', {})

const Text = styled('p', {
fontFamily: '$system',
color: '$hiContrast',
})

const Link = styled('a', {
fontFamily: '$system',
textDecoration: 'none',
color: '$purple600',
})

const Container = styled('div', {
marginX: 'auto',
paddingX: '$3',

variants: {
size: {
'1': {
maxWidth: '300px',
},
'2': {
maxWidth: '585px',
},
'3': {
maxWidth: '865px',
},
},
},
})

export default function Home() {
return (
<Box css={{ paddingY: '$6' }}>
<Head>
<title>Use Stitches with Next.js</title>
</Head>
<Container size={{ initial: '1', bp1: '2' }}>
<StitchesLogo />
<Text as="h1">Hello, from Stitches.</Text>
<Text>
For full documentation, visit{' '}
<Link href="https://stitches.dev">stitches.dev</Link>.
</Text>
</Container>
</Box>
)
}

export const StitchesLogo = () => (
peduarte marked this conversation as resolved.
Show resolved Hide resolved
<svg
xmlns="http://www.w3.org/2000/svg"
width="35"
height="35"
viewBox="0 0 35 35"
fill="none"
>
<circle
cx="17.5"
cy="17.5"
r="14.5"
stroke="currentColor"
strokeWidth="2"
/>
<path d="M12.8184 31.3218L31.8709 20.3218" stroke="currentColor" />
<path d="M3.31836 14.8674L22.3709 3.86743" stroke="currentColor" />
<path
d="M8.65332 29.1077L25.9738 19.1077"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M9.21582 16.0815L26.5363 6.08154"
stroke="currentColor"
strokeLinecap="round"
/>
<path
d="M13.2334 14.2297L22.5099 21.1077"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M16.6973 12.2302L25.9736 19.1078"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M9.21582 16.0815L19.0459 23.1078"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
Loading