Unverified Commit e0b38492 authored by Rob Easthope's avatar Rob Easthope Committed by GitHub

with-stitches example fixes #28650 (#28652)

The with-stitches example is broken presumably due to changes in the Stitches API now that it's hit `1.0.0`. I've created an issue already: #28650 

I've made three small changes:
- Replaced the createCss function in `stitcheds.config.js` with createStitches
- Replaced the getCssString function with getCssText  in `stitches.config.js` and `pages/_documents.jsx`
- Bumped `@stitches/react` to `^1.0.0` 🎉

I've left the rest of the example code alone as I'm still exploring the library after seeing yesterdays release annoucement.

@peduarte Is there anything else that needs to updated?
parent 2425f470
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"start": "next start" "start": "next start"
}, },
"dependencies": { "dependencies": {
"@stitches/react": "latest", "@stitches/react": "^1.0.0",
"next": "latest", "next": "latest",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2" "react-dom": "^17.0.2"
......
import React from 'react' import React from 'react'
import NextDocument, { Html, Head, Main, NextScript } from 'next/document' import NextDocument, { Html, Head, Main, NextScript } from 'next/document'
import { getCssString } from '../stitches.config' import { getCssText } from '../stitches.config'
export default class Document extends NextDocument { export default class Document extends NextDocument {
render() { render() {
...@@ -9,7 +9,7 @@ export default class Document extends NextDocument { ...@@ -9,7 +9,7 @@ export default class Document extends NextDocument {
<Head> <Head>
<style <style
id="stitches" id="stitches"
dangerouslySetInnerHTML={{ __html: getCssString() }} dangerouslySetInnerHTML={{ __html: getCssText() }}
/> />
</Head> </Head>
<body> <body>
......
import { createCss } from '@stitches/react' import { createStitches } from '@stitches/react'
export const { css, styled, global, getCssString } = createCss({ export const {
config,
createTheme,
css,
getCssText,
globalCss,
styled,
theme,
} = createStitches({
theme: { theme: {
colors: { colors: {
hiContrast: 'hsl(206,10%,5%)', hiContrast: 'hsl(206,10%,5%)',
...@@ -49,19 +57,19 @@ export const { css, styled, global, getCssString } = createCss({ ...@@ -49,19 +57,19 @@ export const { css, styled, global, getCssString } = createCss({
}, },
}, },
utils: { utils: {
marginX: (config) => (value) => ({ marginX: (value) => ({
marginLeft: value, marginLeft: value,
marginRight: value, marginRight: value,
}), }),
marginY: (config) => (value) => ({ marginY: (value) => ({
marginTop: value, marginTop: value,
marginBottom: value, marginBottom: value,
}), }),
paddingX: (config) => (value) => ({ paddingX: (value) => ({
paddingLeft: value, paddingLeft: value,
paddingRight: value, paddingRight: value,
}), }),
paddingY: (config) => (value) => ({ paddingY: (value) => ({
paddingTop: value, paddingTop: value,
paddingBottom: value, paddingBottom: value,
}), }),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment