Unverified Commit 6d9ce62f authored by rodrigo's avatar rodrigo Committed by GitHub

examples: update styled-components (#56457)

Co-authored-by: 's avatarLee Robinson <me@leerob.io>
parent f163dd09
{
"private": true,
"scripts": {
"dev": "next",
"dev": "next dev",
"build": "next build",
"start": "next start"
},
......@@ -9,14 +9,13 @@
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"styled-components": "^5.3.5"
"styled-components": "^6.1.0"
},
"devDependencies": {
"@types/node": "18.7.14",
"@types/react": "^18.0.18",
"@types/styled-components": "5.1.26",
"babel-plugin-styled-components": "^2.0.7",
"typescript": "4.8.2"
"@types/node": "^18.18.3",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"babel-plugin-styled-components": "^2.1.4",
"typescript": "^5.2.2"
}
}
import Document, { DocumentContext, DocumentInitialProps } from 'next/document'
import type { DocumentContext, DocumentInitialProps } from 'next/document'
import Document from 'next/document'
import { ServerStyleSheet } from 'styled-components'
export default class MyDocument extends Document {
......
......@@ -4,16 +4,18 @@
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
......
{
"private": true,
"scripts": {
"dev": "next",
"dev": "next dev",
"build": "next build",
"start": "next start"
},
......@@ -9,16 +9,13 @@
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"styled-components": "^5.3.6",
"styled-components": "^6.1.0",
"stylis-plugin-rtl": "^2.1.1"
},
"devDependencies": {
"@types/node": "^18.11.9",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@types/styled-components": "^5.1.26",
"babel-plugin-styled-components": "^2.0.7",
"typescript": "^4.9.3"
"@types/node": "^18.18.3",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"typescript": "^5.2.2"
}
}
......@@ -5,15 +5,17 @@
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
"incremental": true,
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "styled.d.ts"],
"exclude": ["node_modules"]
......
......@@ -27,22 +27,16 @@ const Card = styled.div`
}
`
const StyledA = styled.a`
const StyledLink = styled(Link)`
margin: 0 0 1rem 0;
font-size: 1.5rem;
`
const StyledLink = ({ href, name }) => (
<Link href={href} passHref legacyBehavior>
<StyledA>{name}</StyledA>
</Link>
)
export default function Cards() {
return (
<FlexContainer>
<Card>
<StyledLink href="/about" name="About Page &rarr;" />
<StyledLink href="/about">About Page &rarr;</StyledLink>
</Card>
</FlexContainer>
)
......
{
"private": true,
"scripts": {
"dev": "next",
"dev": "next dev",
"build": "next build",
"start": "next start"
},
......@@ -9,13 +9,12 @@
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.5"
"styled-components": "^6.1.0"
},
"devDependencies": {
"@types/node": "^18.0.0",
"@types/react": "^18.0.14",
"@types/react-dom": "^18.0.5",
"@types/styled-components": "^5.1.25",
"typescript": "^4.7.4"
"@types/node": "^18.18.3",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"typescript": "^5.2.2"
}
}
import type { AppProps } from 'next/app'
import { ThemeProvider, DefaultTheme } from 'styled-components'
import GlobalStyle from '../components/globalstyles'
import { ThemeProvider, type DefaultTheme } from 'styled-components'
import GlobalStyle from '@/components/globalstyles'
const theme: DefaultTheme = {
colors: {
......
import Document, { DocumentContext } from 'next/document'
import type { DocumentContext, DocumentInitialProps } from 'next/document'
import Document from 'next/document'
import { ServerStyleSheet } from 'styled-components'
export default class MyDocument extends Document {
static async getInitialProps(ctx: DocumentContext) {
static async getInitialProps(
ctx: DocumentContext
): Promise<DocumentInitialProps> {
const sheet = new ServerStyleSheet()
const originalRenderPage = ctx.renderPage
......
import Link from 'next/link'
import { Container, Main, Title, Description } from '../components/sharedstyles'
import { Container, Main, Title, Description } from '@/components/sharedstyles'
export default function About() {
return (
......
......@@ -5,8 +5,8 @@ import {
Title,
Description,
CodeTag,
} from '../components/sharedstyles'
import Cards from '../components/cards'
} from '@/components/sharedstyles'
import Cards from '@/components/cards'
export default function Home() {
return (
......
......@@ -4,17 +4,19 @@
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"moduleResolution": "node",
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "styled.d.ts"],
"exclude": ["node_modules"]
}
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