Skip to content

Commit 459726d

Browse files
committed
App
1 parent 6c337ba commit 459726d

26 files changed

+1612
-286
lines changed

Diff for: .editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
end_of_line = lf
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

Diff for: .eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.next
3+
/*.js

Diff for: .eslintrc.json

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es2020": true,
5+
"node": true,
6+
"jest": true
7+
},
8+
"extends": [
9+
"plugin:react/recommended",
10+
"standard",
11+
"plugin:@typescript-eslint/recommended",
12+
"prettier/@typescript-eslint",
13+
"prettier/standard",
14+
"prettier/react"
15+
],
16+
"parser": "@typescript-eslint/parser",
17+
"parserOptions": {
18+
"ecmaFeatures": {
19+
"jsx": true
20+
},
21+
"ecmaVersion": 12,
22+
"sourceType": "module"
23+
},
24+
"plugins": [
25+
"react",
26+
"@typescript-eslint",
27+
"prettier"
28+
],
29+
"rules": {
30+
"prettier/prettier": "error",
31+
"space-before-function-paren": "off",
32+
"react/prop-types": "off"
33+
}
34+
}

Diff for: README.md

-30
This file was deleted.

Diff for: babel.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
presets: ["next/babel"],
3+
plugins: [
4+
["styled-components", { "ssr": true }],
5+
"inline-react-svg"
6+
]
7+
};

Diff for: next-env.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/types/global" />
3+
/// <reference types="next-images" />

Diff for: next.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const withImages = require('next-images')
2+
3+
module.exports = withImages({
4+
esModule: true,
5+
})

Diff for: package.json

+22-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,28 @@
99
},
1010
"dependencies": {
1111
"next": "9.5.2",
12+
"next-images": "^1.4.1",
1213
"react": "16.13.1",
13-
"react-dom": "16.13.1"
14+
"react-dom": "16.13.1",
15+
"styled-components": "^5.1.1"
16+
},
17+
"devDependencies": {
18+
"@types/node": "^14.6.0",
19+
"@types/react": "^16.9.46",
20+
"@types/styled-components": "^5.1.2",
21+
"@typescript-eslint/eslint-plugin": "^3.9.1",
22+
"@typescript-eslint/parser": "^3.9.1",
23+
"babel-plugin-inline-react-svg": "^1.1.1",
24+
"eslint": "^7.7.0",
25+
"eslint-config-prettier": "^6.11.0",
26+
"eslint-config-standard": "^14.1.1",
27+
"eslint-plugin-import": "^2.22.0",
28+
"eslint-plugin-node": "^11.1.0",
29+
"eslint-plugin-prettier": "^3.1.4",
30+
"eslint-plugin-promise": "^4.2.1",
31+
"eslint-plugin-react": "^7.20.6",
32+
"eslint-plugin-standard": "^4.0.1",
33+
"prettier": "^2.1.0",
34+
"typescript": "^4.0.2"
1435
}
1536
}

Diff for: pages/_app.js

-7
This file was deleted.

Diff for: pages/api/hello.js

-6
This file was deleted.

Diff for: pages/index.js

-65
This file was deleted.

Diff for: prettier.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
semi: false,
3+
singleQuote: true,
4+
arrowParens: 'avoid',
5+
trailingComma: 'none',
6+
endOfLine: 'auto'
7+
};

Diff for: public/favicon.ico

-14.7 KB
Binary file not shown.

Diff for: public/vercel.svg

-4
This file was deleted.

Diff for: src/assets/rocketseat.svg

+15
Loading

Diff for: src/pages/_app.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react'
2+
import { AppProps } from 'next/app'
3+
import { ThemeProvider } from 'styled-components'
4+
5+
import GlobalStyle from '../styles/global'
6+
import theme from '../styles/theme'
7+
8+
const MyApp: React.FC<AppProps> = ({ Component, pageProps }) => {
9+
return (
10+
<ThemeProvider theme={theme}>
11+
<Component {...pageProps} />
12+
<GlobalStyle />
13+
</ThemeProvider>
14+
)
15+
}
16+
17+
export default MyApp

Diff for: src/pages/_document.tsx

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import React from 'react'
2+
import Document, {
3+
DocumentInitialProps,
4+
DocumentContext,
5+
Html,
6+
Head,
7+
Main,
8+
NextScript
9+
} from 'next/document'
10+
import { ServerStyleSheet } from 'styled-components'
11+
12+
export default class MyDocument extends Document {
13+
static async getInitialProps(
14+
ctx: DocumentContext
15+
): Promise<DocumentInitialProps> {
16+
const sheet = new ServerStyleSheet()
17+
const originalRenderPage = ctx.renderPage
18+
19+
try {
20+
ctx.renderPage = () =>
21+
originalRenderPage({
22+
enhanceApp: App => props => sheet.collectStyles(<App {...props} />)
23+
})
24+
25+
const initialProps = await Document.getInitialProps(ctx)
26+
return {
27+
...initialProps,
28+
styles: (
29+
<>
30+
{initialProps.styles}
31+
{sheet.getStyleElement()}
32+
</>
33+
)
34+
}
35+
} finally {
36+
sheet.seal()
37+
}
38+
}
39+
40+
render(): JSX.Element {
41+
return (
42+
<Html lang="pt">
43+
<Head>
44+
<meta charSet="utf-8" />
45+
46+
<link
47+
href="https://fonts.googleapis.com/css?family=Roboto:400,500,700"
48+
rel="stylesheet"
49+
/>
50+
51+
<link rel="icon" href="https://rocketseat.com.br/favicon.ico" />
52+
</Head>
53+
<body>
54+
<Main />
55+
<NextScript />
56+
</body>
57+
</Html>
58+
)
59+
}
60+
}

Diff for: src/pages/index.tsx

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import Head from 'next/head'
3+
4+
import RocketseatLogo from '../assets/rocketseat.svg'
5+
6+
import { Container } from '../styles/pages/Home'
7+
8+
const Home: React.FC = () => {
9+
return (
10+
<Container>
11+
<Head>
12+
<title>Homepage</title>
13+
</Head>
14+
15+
<RocketseatLogo />
16+
<h1>ReactJS Structure</h1>
17+
<p>A ReactJS + Next.js structure made by Rocketseat.</p>
18+
</Container>
19+
)
20+
}
21+
22+
export default Home

Diff for: src/styles/global.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { createGlobalStyle } from 'styled-components'
2+
3+
export default createGlobalStyle`
4+
* {
5+
margin: 0;
6+
padding: 0;
7+
box-sizing: border-box;
8+
}
9+
10+
body {
11+
background: ${props => props.theme.colors.background};
12+
color: ${props => props.theme.colors.text};
13+
font: 400 16px Roboto, sans-serif;
14+
}
15+
`

Diff for: src/styles/pages/Home.ts

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import styled from 'styled-components'
2+
3+
export const Container = styled.div`
4+
width: 100vw;
5+
height: 100vh;
6+
7+
display: flex;
8+
justify-content: center;
9+
align-items: center;
10+
flex-direction: column;
11+
12+
h1 {
13+
font-size: 54px;
14+
color: ${props => props.theme.colors.primary};
15+
margin-top: 40px;
16+
}
17+
18+
p {
19+
margin-top: 24px;
20+
font-size: 24px;
21+
line-height: 32px;
22+
}
23+
`

Diff for: src/styles/styled.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* eslint @typescript-eslint/no-empty-interface: "off" */
2+
3+
import 'styled-components'
4+
5+
import theme from './theme'
6+
7+
export type Theme = typeof theme
8+
9+
declare module 'styled-components' {
10+
export interface DefaultTheme extends Theme {}
11+
}

0 commit comments

Comments
 (0)