이정민

next + ts 세팅

1 +{
2 + "presets": [
3 + "next/babel"
4 + ],
5 + "plugins": [
6 + [
7 + "babel-plugin-styled-components",
8 + {
9 + "fileName": true,
10 + "displayName": true,
11 + "pure": true
12 + }
13 + ]
14 + ]
15 +}
...\ No newline at end of file ...\ No newline at end of file
1 +export const browserslist = ["defaults"];
1 -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 1 +# Config
2 +!config/default.json
3 +!config/development.json.sample
4 +config/*.json
2 5
3 -# dependencies 6 +# Next
4 -/node_modules 7 +.next
5 -/.pnp 8 +out
6 -.pnp.js
7 9
8 -# testing 10 +# Logs
9 -/coverage 11 +npm-debug.log*
12 +
13 +# NPM
14 +node_modules/
10 15
11 -# production 16 +# Transpiled code
12 -/build 17 +dist
18 +out
19 +.out
13 20
14 -# misc 21 +# Dev tools
15 .DS_Store 22 .DS_Store
16 -.env.local 23 +.vscode
17 -.env.development.local 24 +.idea
18 -.env.test.local 25 +*.swp
19 -.env.production.local 26 +*.bak
20 27
21 -npm-debug.log* 28 +node_modules.nosync/
22 -yarn-debug.log* 29 +*.env.*
23 -yarn-error.log*
...\ No newline at end of file ...\ No newline at end of file
......
1 +{
2 + "editor.formatOnSave": true,
3 + "prettier.semi": false,
4 + "prettier.trailingComma": "all",
5 + "prettier.singleQuote": true,
6 + "prettier.tslintIntegration": true,
7 + "prettier.tabWidth": 2,
8 + "prettier.printWidth": 120
9 +}
1 +/// <reference types="next" />
2 +/// <reference types="next/types/global" />
1 +/* eslint-disable @typescript-eslint/no-var-requires */
2 +const withBundleAnalyzer = require("@next/bundle-analyzer")({
3 + enabled: process.env.ANALYZE === "true",
4 +});
5 +
6 +module.exports = withBundleAnalyzer({
7 + target: "serverless",
8 + env: {
9 + BASE_URL: process.env.BASE_URL,
10 + },
11 +
12 + webpack(conf) {
13 + conf.module.rules.push({
14 + test: /\.svg$/,
15 + use: [
16 + {
17 + loader: "@svgr/webpack",
18 + options: {
19 + svgoConfig: {
20 + plugins: [
21 + {
22 + // Enable figma's wrong mask-type attribute work
23 + removeRasterImages: false,
24 + removeStyleElement: false,
25 + removeUnknownsAndDefaults: false,
26 + // Enable svgr's svg to fill the size
27 + removeViewBox: false,
28 + },
29 + ],
30 + },
31 + },
32 + },
33 + ],
34 + });
35 + // 절대경로
36 + conf.resolve.modules.push(__dirname);
37 + return conf;
38 + },
39 +});
...@@ -6,17 +6,46 @@ ...@@ -6,17 +6,46 @@
6 "@testing-library/jest-dom": "^5.11.4", 6 "@testing-library/jest-dom": "^5.11.4",
7 "@testing-library/react": "^11.1.0", 7 "@testing-library/react": "^11.1.0",
8 "@testing-library/user-event": "^12.1.10", 8 "@testing-library/user-event": "^12.1.10",
9 + "@next/bundle-analyzer": "^10.0.7",
9 "react": "^17.0.2", 10 "react": "^17.0.2",
10 "react-dom": "^17.0.2", 11 "react-dom": "^17.0.2",
11 - "react-scripts": "4.0.3",
12 "styled-components": "^5.2.3", 12 "styled-components": "^5.2.3",
13 - "web-vitals": "^1.0.1" 13 + "web-vitals": "^1.0.1",
14 + "next": "^10.0.5",
15 + "styled-reset": "^4.3.4"
16 + },
17 + "devDependencies": {
18 + "@babel/core": "^7.13.10",
19 + "@babel/plugin-syntax-dynamic-import": "^7.8.3",
20 + "@svgr/webpack": "^5.5.0",
21 + "@types/node": "^14.14.22",
22 + "@types/react": "^17.0.0",
23 + "@types/react-dom": "^17.0.0",
24 + "@types/react-window": "^1.8.2",
25 + "@types/styled-components": "^5.1.7",
26 + "@typescript-eslint/eslint-plugin": "^4.14.1",
27 + "@typescript-eslint/eslint-plugin-tslint": "^4.14.1",
28 + "@typescript-eslint/parser": "^4.14.1",
29 + "babel-loader": "^8.2.2",
30 + "eslint": "^7.18.0",
31 + "eslint-config-airbnb-typescript": "^12.3.1",
32 + "eslint-config-prettier": "^8.1.0",
33 + "eslint-plugin-import": "^2.22.1",
34 + "eslint-plugin-jsx-a11y": "^6.4.1",
35 + "eslint-plugin-react": "^7.22.0",
36 + "eslint-plugin-react-hooks": "^4.2.0",
37 + "prettier": "^2.2.1",
38 + "typescript": "^4.1.3"
14 }, 39 },
15 "scripts": { 40 "scripts": {
16 - "start": "react-scripts start", 41 + "dev": "next",
17 - "build": "react-scripts build", 42 + "debug": "NODE_OPTIONS='--inspect' next dev",
18 - "test": "react-scripts test", 43 + "build": "next build",
19 - "eject": "react-scripts eject" 44 + "start": "next start",
45 + "export": "next export",
46 + "type-check": "tsc",
47 + "eslint": "eslint .",
48 + "analyze": "ANALYZE=true next build"
20 }, 49 },
21 "eslintConfig": { 50 "eslintConfig": {
22 "extends": [ 51 "extends": [
......
No preview for this file type
1 -<!DOCTYPE html>
2 -<html lang="en">
3 - <head>
4 - <meta charset="utf-8" />
5 - <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6 - <meta name="viewport" content="width=device-width, initial-scale=1" />
7 - <meta name="theme-color" content="#000000" />
8 - <meta
9 - name="description"
10 - content="Web site created using create-react-app"
11 - />
12 - <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13 - <!--
14 - manifest.json provides metadata used when your web app is installed on a
15 - user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16 - -->
17 - <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18 - <!--
19 - Notice the use of %PUBLIC_URL% in the tags above.
20 - It will be replaced with the URL of the `public` folder during the build.
21 - Only files inside the `public` folder can be referenced from the HTML.
22 -
23 - Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24 - work correctly both with client-side routing and a non-root public URL.
25 - Learn how to configure a non-root public URL by running `npm run build`.
26 - -->
27 - <title>React App</title>
28 - </head>
29 - <body>
30 - <noscript>You need to enable JavaScript to run this app.</noscript>
31 - <div id="root"></div>
32 - <!--
33 - This HTML file is a template.
34 - If you open it directly in the browser, you will see an empty page.
35 -
36 - You can add webfonts, meta tags, or analytics to this file.
37 - The build step will place the bundled scripts into the <body> tag.
38 -
39 - To begin the development, run `npm start` or `yarn start`.
40 - To create a production bundle, use `npm run build` or `yarn build`.
41 - -->
42 - </body>
43 -</html>
1 -{
2 - "short_name": "React App",
3 - "name": "Create React App Sample",
4 - "icons": [
5 - {
6 - "src": "favicon.ico",
7 - "sizes": "64x64 32x32 24x24 16x16",
8 - "type": "image/x-icon"
9 - },
10 - {
11 - "src": "logo192.png",
12 - "type": "image/png",
13 - "sizes": "192x192"
14 - },
15 - {
16 - "src": "logo512.png",
17 - "type": "image/png",
18 - "sizes": "512x512"
19 - }
20 - ],
21 - "start_url": ".",
22 - "display": "standalone",
23 - "theme_color": "#000000",
24 - "background_color": "#ffffff"
25 -}
1 -# https://www.robotstxt.org/robotstxt.html
2 -User-agent: *
3 -Disallow:
1 -body {
2 - margin: 0;
3 - font-size: 10px;
4 - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
5 - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
6 - sans-serif;
7 - -webkit-font-smoothing: antialiased;
8 - -moz-osx-font-smoothing: grayscale;
9 - background-color: #f7f7f7;
10 -}
11 -
12 -code {
13 - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
14 - monospace;
15 -}
1 -import React from "react";
2 -import ReactDOM from "react-dom";
3 -import App from "./App";
4 -import { theme } from "./theme";
5 -import "./index.css";
6 -import { ThemeProvider } from "styled-components";
7 -
8 -ReactDOM.render(
9 - <React.StrictMode>
10 - <ThemeProvider theme={theme}>
11 - <App />
12 - </ThemeProvider>
13 - </React.StrictMode>,
14 - document.getElementById("root")
15 -);
1 +import type { AppProps } from "next/app";
2 +import Head from "next/head";
3 +import { ThemeProvider } from "styled-components";
4 +import { GlobalStyle } from "styles/global-style";
5 +import { theme } from "styles/theme";
6 +
7 +function MyApp({ Component, pageProps }: AppProps) {
8 + return (
9 + <>
10 + <Head>
11 + <meta name="viewport" content="width=device-width, initial-scale=1" />
12 + <title>Gif Generator</title>
13 + </Head>
14 + <GlobalStyle />
15 + <ThemeProvider theme={theme}>
16 + <Component {...pageProps} />
17 + <div id="modal-root" />
18 + </ThemeProvider>
19 + </>
20 + );
21 +}
22 +
23 +export default MyApp;
1 +import Document, {
2 + Html,
3 + Head,
4 + Main,
5 + NextScript,
6 + DocumentContext,
7 +} from "next/document";
8 +import { ServerStyleSheet } from "styled-components";
9 +
10 +class MyDocument extends Document {
11 + static async getInitialProps(ctx: DocumentContext) {
12 + const sheet = new ServerStyleSheet();
13 + const originalRenderPage = ctx.renderPage;
14 + try {
15 + ctx.renderPage = () =>
16 + originalRenderPage({
17 + enhanceApp: (App) => (props) =>
18 + sheet.collectStyles(<App {...props} />),
19 + });
20 +
21 + const initialProps = await Document.getInitialProps(ctx);
22 + return {
23 + ...initialProps,
24 + styles: (
25 + <>
26 + {initialProps.styles}
27 + {sheet.getStyleElement()}
28 + </>
29 + ),
30 + };
31 + } finally {
32 + sheet.seal();
33 + }
34 + }
35 +
36 + render() {
37 + return (
38 + <Html>
39 + <Head>
40 + <meta charSet="utf-8" />
41 + <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
42 + <meta property="og:title" content="네이버 예약" />
43 + <link rel="preconnect" href="https://fonts.gstatic.com" />
44 + <link
45 + href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap"
46 + rel="preload"
47 + as="style"
48 + />
49 + <link
50 + href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap"
51 + rel="stylesheet"
52 + />
53 + <script
54 + type="text/javascript"
55 + src="https://openapi.map.naver.com/openapi/v3/maps.js?ncpClientId=3ioixdkru3"
56 + />
57 + </Head>
58 + <body>
59 + <Main />
60 + <NextScript />
61 + </body>
62 + </Html>
63 + );
64 + }
65 +}
66 +
67 +export default MyDocument;
1 +import Header from "components/Header";
2 +import Image from "components/Image";
1 import styled from "styled-components"; 3 import styled from "styled-components";
2 -import Header from "./components/Header";
3 -import Image from "./components/Image";
4 4
5 -function App() { 5 +const Index = () => (
6 - return ( 6 + <Container>
7 - <Container> 7 + <Header />
8 - <Header /> 8 + <Image />
9 - <Image /> 9 + </Container>
10 - </Container> 10 +);
11 - );
12 -}
13 11
14 const Container = styled.div` 12 const Container = styled.div`
15 display: flex; 13 display: flex;
...@@ -17,4 +15,4 @@ const Container = styled.div` ...@@ -17,4 +15,4 @@ const Container = styled.div`
17 align-items: center; 15 align-items: center;
18 `; 16 `;
19 17
20 -export default App; 18 +export default Index;
......
1 +import { createGlobalStyle } from "styled-components";
2 +import { reset } from "styled-reset";
3 +import { media } from "./theme";
4 +
5 +export const GlobalStyle = createGlobalStyle`
6 + ${reset}
7 + :focus {
8 + outline: none;
9 + border: none;
10 + }
11 + div[role="button"] {
12 + cursor: pointer;
13 + }
14 + ::-webkit-scrollbar {
15 + display: none;
16 + }
17 + html{
18 + -webkit-text-size-adjust: none;
19 + font-family: -apple-system,BlinkMacSystemFont,helvetica,Apple SD Gothic Neo,sans-serif;
20 + font-display: fallback;
21 + ${media.tablet}{
22 + font-size: 10px;
23 + }
24 + -ms-overflow-style: none;
25 + scrollbar-width: none;
26 + }
27 + button {
28 + background: none;
29 + padding: 0;
30 + border: none;
31 + cursor: pointer;
32 + &:disabled {
33 + cursor: default;
34 + fill: #f2f3f4;
35 + }
36 + }
37 +
38 + .pc-tablet-only {
39 + display: block;
40 + ${media.mobile} {
41 + display: none;
42 + }
43 + }
44 + .tablet-mobile-only{
45 + display: none;
46 + ${media.tablet}{
47 + display:block;
48 + }
49 + }
50 + .mobile-only {
51 + display: none;
52 + ${media.mobile} {
53 + display: block;
54 + }
55 + }
56 +`;
1 +import "styled-components";
2 +
3 +declare module "styled-components" {
4 + export interface DefaultTheme {
5 + color: {
6 + purple: "#8661de";
7 + blue: "#00bac7";
8 + gray: "#f6f6f6";
9 + green: "#07b495";
10 + lightGreen: "#99ecdd";
11 + darkGray: "#54595d";
12 + };
13 + boxShadow: {
14 + normal: "0 3px 8px 0 rgb(0 0 0 / 10%)";
15 + purple: "0 3px 8px 0 #d6c9ff";
16 + blue: "0 3px 8px 0 #b3e2e6";
17 + };
18 + }
19 +}
1 -export const theme = { 1 +import { DefaultTheme } from "styled-components";
2 +
3 +export const theme: DefaultTheme = {
2 color: { 4 color: {
3 purple: "#8661de", 5 purple: "#8661de",
4 blue: "#00bac7", 6 blue: "#00bac7",
...@@ -14,7 +16,8 @@ export const theme = { ...@@ -14,7 +16,8 @@ export const theme = {
14 }, 16 },
15 }; 17 };
16 18
17 -const customMediaQuery = (maxWidth) => `@media (max-width: ${maxWidth}px)`; 19 +const customMediaQuery = (maxWidth: number): string =>
20 + `@media (max-width: ${maxWidth}px)`;
18 21
19 export const media = { 22 export const media = {
20 custom: customMediaQuery, 23 custom: customMediaQuery,
......
1 +{
2 + "compilerOptions": {
3 + "target": "es5",
4 + "lib": [
5 + "dom",
6 + "dom.iterable",
7 + "esnext"
8 + ],
9 + "allowJs": true,
10 + "skipLibCheck": true,
11 + "strict": false,
12 + "forceConsistentCasingInFileNames": true,
13 + "noEmit": true,
14 + "esModuleInterop": true,
15 + "module": "esnext",
16 + "moduleResolution": "node",
17 + "resolveJsonModule": true,
18 + "isolatedModules": true,
19 + "jsx": "preserve",
20 + "baseUrl": "src",
21 + "rootDir": "src",
22 + },
23 + "include": [
24 + "next-env.d.ts",
25 + "**/*.ts",
26 + "**/*.tsx",
27 + "next.config.js",
28 + "custom.d.ts",
29 + "styled.d.ts",
30 + "src/styles",
31 + "src/pages",
32 + "public",
33 + "**/*.scss",
34 + "src/components",
35 + "resources",
36 + ],
37 + "exclude": [
38 + "node_modules",
39 + ]
40 +}
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.