Unverified Commit 4e5a359a authored by Turadg Aleahmad's avatar Turadg Aleahmad Committed by GitHub

update with-linaria example (#23332)

## Documentation / Examples

* removes deprecated `@zeit/next-css`.
* adds https://github.com/Mistereo/next-linaria to work with the new built-in CSS functionality.
* updates Linaria to latest release (v3 will require https://github.com/Mistereo/next-linaria/pull/3 ) 
* adds an example of using Linaria without React
* gitignores `.linaria-cache`
parent f28ea89a
......@@ -32,3 +32,6 @@ yarn-error.log*
# vercel
.vercel
# Linaria
.linaria-cache/
const withCSS = require('@zeit/next-css')
const withLinaria = require('next-linaria')
module.exports = withCSS({
webpack(config, options) {
config.module.rules.push({
test: /\.js$/,
use: [
{
loader: 'linaria/loader',
options: {
sourceMap: process.env.NODE_ENV !== 'production',
},
},
],
})
return config
},
})
module.exports = withLinaria({})
......@@ -7,11 +7,14 @@
"start": "next start"
},
"dependencies": {
"@zeit/next-css": "^1.0.1",
"linaria": "2.0.0-alpha.5",
"linaria": "^2.1.0",
"next": "latest",
"next-linaria": "^0.10.0",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"devDependencies": {
"@babel/core": "^7.13.10"
},
"license": "MIT"
}
import Head from 'next/head'
import { styled } from 'linaria/react'
import { css } from 'linaria'
const Box = styled.div`
margin-top: 40px;
......@@ -20,13 +21,17 @@ const Box = styled.div`
}
`
const anotherClass = css`
color: blue;
`
export default function Home() {
return (
<>
<Head>
<title>With Linaria</title>
</Head>
<Box>Zero runtime CSS in JS</Box>
<Box className={anotherClass}>Zero runtime CSS in JS</Box>
</>
)
}
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