sungjin

Make new Frontend with NextJS, with Auth

1 +This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2 +
3 +## Getting Started
4 +
5 +First, run the development server:
6 +
7 +```bash
8 +npm run dev
9 +# or
10 +yarn dev
11 +```
12 +
13 +Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
14 +
15 +You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
16 +
17 +[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
18 +
19 +The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20 +
21 +## Learn More
22 +
23 +To learn more about Next.js, take a look at the following resources:
24 +
25 +- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
26 +- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
27 +
28 +You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
29 +
30 +## Deploy on Vercel
31 +
32 +The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33 +
34 +Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
1 +module.exports = {
2 + reactStrictMode: true,
3 +}
This diff could not be displayed because it is too large.
1 { 1 {
2 - "name": "learn_with_code", 2 + "name": "learn-in-web",
3 - "version": "1.0.0", 3 + "private": true,
4 - "description": "",
5 - "main": "index.js",
6 "scripts": { 4 "scripts": {
7 - "test": "echo \"Error: no test specified\" && exit 1", 5 + "dev": "next dev",
8 - "start": "npm run build:live", 6 + "build": "next build",
9 - "build": "tsc -p .", 7 + "start": "next start",
10 - "build:live": "nodemon --watch 'src/**/*.ts' --exec \"ts-node\" src/index.ts" 8 + "lint": "next lint"
11 - },
12 - "keywords": [],
13 - "author": "",
14 - "license": "ISC",
15 - "devDependencies": {
16 - "@types/express": "^4.17.13",
17 - "@types/node": "^16.11.6",
18 - "nodemon": "^2.0.14",
19 - "ts-node": "^10.4.0",
20 - "typescript": "^4.4.4"
21 }, 9 },
22 "dependencies": { 10 "dependencies": {
23 - "express": "^4.17.1" 11 + "@heroicons/react": "^1.0.5",
12 + "axios": "^0.24.0",
13 + "next": "12.0.4",
14 + "next-auth": "^3.29.0",
15 + "react": "17.0.2",
16 + "react-dom": "17.0.2",
17 + "semantic-ui-react": "^2.0.4",
18 + "swr": "^1.0.1"
19 + },
20 + "devDependencies": {
21 + "autoprefixer": "^10.4.0",
22 + "eslint": "7.32.0",
23 + "eslint-config-next": "12.0.4",
24 + "postcss": "^8.3.11",
25 + "tailwindcss": "^2.2.19"
24 } 26 }
25 } 27 }
......
1 +module.exports = {
2 + plugins: {
3 + tailwindcss: {},
4 + autoprefixer: {},
5 + },
6 +}
No preview for this file type
1 +<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
2 + xmlns="http://www.w3.org/2000/svg">
3 + <path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
4 +</svg>
...\ No newline at end of file ...\ No newline at end of file
1 +import { useSession } from 'next-auth/client';
2 +import axios from 'axios';
3 +import { SERVER_BASE_URL } from '..';
4 +
5 +// login request to the server with axios and next-auth
6 +export const login = async (email, password) => {
7 + const response = await axios.post(`${SERVER_BASE_URL}/auth/signin` , {
8 + email,
9 + password,
10 + });
11 + if (response.status !== 200 && response.status !== 201) {
12 + throw new Error('Login failed!');
13 + }
14 + console.log(response.data.access_token)
15 + useSession.accessToken = response.data.access_token;
16 + return response.data;
17 +}
18 +
19 +export const signup = async (name, email, password) => {
20 + const response = await axios.post(`${SERVER_BASE_URL}/auth/signup`, {
21 + name,
22 + email,
23 + password,
24 + });
25 + if (response.status !== 200 && response.status !== 201) {
26 + throw new Error('Signup failed!');
27 + }
28 + useSession.accessToken = response.data.access_token;
29 + return response.data;
30 +}
31 +
32 +export const logout = async () => {1
33 + useSession.accessToken = null;
34 + return true;
35 +}
36 +
37 +export const getUser = async () => {
38 + const response = await axios.get(`${SERVER_BASE_URL}/auth/validate`, {
39 + token: useSession.accessToken,
40 + });
41 + if (response.status !== 200 && response.status !== 201) {
42 + throw new Error('Failed to get user!');
43 + }
44 + return response.data;
45 +}
46 +
47 +export const refreshToken = async () => {
48 + const response = await axios.post(`${SERVER_BASE_URL}/auth/refresh`, {
49 + token: useSession.accessToken,
50 + });
51 + if (response.status !== 200 && response.status !== 201) {
52 + throw new Error('Failed to refresh token!');
53 + }
54 + useSession.accessToken = response.data.access_token;
55 + return response.data;
56 +}
57 +
58 +export const validateToken = async () => {
59 + const response = await axios.post(`${SERVER_BASE_URL}/auth/validate`, {
60 + token: useSession.accessToken,
61 + });
62 + if (response.status !== 200 && response.status !== 201) {
63 + return false;
64 + }
65 + return true;
66 +}
67 +
68 +export const getToken = () => {
69 + return useSession.accessToken;
70 +}
...\ No newline at end of file ...\ No newline at end of file
1 +export * from './auth';
...\ No newline at end of file ...\ No newline at end of file
1 +export const SERVER_BASE_URL = 'http://localhost:4000';
...\ No newline at end of file ...\ No newline at end of file
1 +export * from './post'
...\ No newline at end of file ...\ No newline at end of file
1 +import auth from '../auth'
2 +import axios from 'axios';
3 +import { SERVER_BASE_URL } from '..';
4 +
5 +export const newPost = async (title, content, privat) => {
6 + if (!auth.validateToken()) {
7 + throw new Error("plz login");
8 + }
9 + const response = await axios.post(`${SERVER_BASE_URL}/post/new`, {
10 + token: auth.getToken(),
11 + title,
12 + content,
13 + privat,
14 + });
15 + if (response.status !== 200) {
16 + throw new Error('Failed to create new post!');
17 + }
18 + return response.data;
19 +}
20 +
21 +export const getPostbyId = async (id) => {
22 + const response = await axios.get(`${SERVERBASE_URL}/post/${id}`);
23 + if (response.status !== 200) {
24 + throw new Error('Failed to get post!');
25 + }
26 + return response.data;
27 +}
...\ No newline at end of file ...\ No newline at end of file
1 +function Footer() {
2 + return (
3 + <div>Copyright @ SungJin. All right reserved.</div>
4 + )
5 +}
6 +
7 +export default Footer
...\ No newline at end of file ...\ No newline at end of file
1 +import {
2 + HomeIcon,
3 + SearchIcon,
4 + UserIcon,
5 + CubeIcon,
6 + MailIcon,
7 + StarIcon
8 +} from "@heroicons/react/outline"
9 +import { useSession } from "next-auth/client"
10 +import HeaderItem from "./HeaderItem"
11 +import Islogin from "./islogin"
12 +import Link from "next/link"
13 +
14 +function Header() {
15 + return (
16 + <header className="flex flex-col sm:flex-row m-5 justify-between items-center">
17 + <Link href="/" passHref>
18 + <div className="flex cursor-pointer transform hover:scale-105">
19 + <CubeIcon className="h-20" />
20 + <p className="text-7xl font-extrabold" >Learn In Web</p>
21 + </div></Link>
22 + <div className="flex flex-grow justify-evenly max-w-sm">
23 + <HeaderItem title='HOME' Icon={HomeIcon} />
24 + <HeaderItem title='STAR' Icon={StarIcon} />
25 + <HeaderItem title='SEARCH' Icon={SearchIcon} />
26 + <HeaderItem title='ACCOUNT' Icon={UserIcon} />
27 + </div>
28 + <Islogin />
29 + </header>
30 +
31 + )
32 +}
33 +
34 +export default Header
...\ No newline at end of file ...\ No newline at end of file
1 +function HeaderItem({ Icon, title }) {
2 + return (
3 + <div className="flex flex-col items-center cursor-pointer group w-12 sm:w-20 hover:text-white">
4 + <Icon className="h-8 mb-1 group-hover:animate-bounce"/>
5 + <p className="opacity-0 group-hover:opacity-100 tracking-widest">{title}</p>
6 + </div>
7 + )
8 +}
9 +
10 +export default HeaderItem
...\ No newline at end of file ...\ No newline at end of file
1 +import router from "next/router"
2 +
3 +export default function Nav() {
4 + return (
5 + <nav className="navbar">
6 + <div className="flex px-10 sm:px-20 text-2xl whitespace-nowrap
7 + space-x-10 sm:space-x-20">
8 + <a herf="" className="last:pr-24 cursor-pointer transition
9 + duration-100 transform hover:scale-125 hover:text-white
10 + active:text-blue-500">난이도 </a>
11 + <a herf="" className="last:pr-24 cursor-pointer transition
12 + duration-100 transform hover:scale-125 hover:text-white
13 + active:text-blue-500">난이도 </a>
14 + <a herf="" className="last:pr-24 cursor-pointer transition
15 + duration-100 transform hover:scale-125 hover:text-white
16 + active:text-blue-500">난이도 </a>
17 + <a herf="" className="last:pr-24 cursor-pointer transition
18 + duration-100 transform hover:scale-125 hover:text-white
19 + active:text-blue-500">북마크</a>
20 + </div>
21 + </nav>
22 + )
23 +}
...\ No newline at end of file ...\ No newline at end of file
1 +import { useSession } from "next-auth/client"
2 +import Link from "next/link"
3 +
4 +function Islogin() {
5 + if (useSession.accessToken) {
6 + return (
7 + <LogoutRedirect />
8 + )
9 + } else {
10 + return (
11 + <LoginRedirect />
12 + )
13 + }
14 +}
15 +
16 +function LogoutRedirect() {
17 + return (
18 + <div>
19 + <Link href="/logout"><a className="flex flex-grow justify-evenly">로그아웃</a></Link>
20 + </div>
21 + )
22 +}
23 +
24 +function LoginRedirect () {
25 + return (
26 + <div>
27 + <Link href="/login"><a className="flex flex-grow justify-evenly">로그인</a></Link>
28 + <Link href="/signup"><a className="flex flex-grow justify-evenly">회원가입</a></Link>
29 + </div>
30 + )
31 +}
32 +
33 +
34 +
35 +export default Islogin
...\ No newline at end of file ...\ No newline at end of file
1 -const _PORT = 3000;
2 -
3 -import * as express from "express";
4 -import {Runner} from "./runner";
5 -
6 -const app = express.default();
7 -
8 -app.use(express.json());
9 -
10 -/*RESTful API*/
11 -
12 -app.post("/runcode", function (req, res) {
13 - var run = new Runner(req);
14 - run.run();
15 - res.send(run.output);
16 -});
17 -
18 -
19 -
20 -app.listen(_PORT, () => {
21 - console.log("server started at port " + _PORT);
22 -});
1 +import '../styles/globals.css'
2 +import Header from '../components/Header'
3 +import Nav from '../components/Nav'
4 +import Footer from '../components/Footer'
5 +
6 +function MyApp({ Component, pageProps }) {
7 + return (
8 + <div>
9 + <Header />
10 + <Nav />
11 + <Component {...pageProps} />
12 + <Footer />
13 + </div>
14 + )
15 +}
16 +
17 +export default MyApp
1 +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2 +
3 +export default function handler(req, res) {
4 + res.status(200).json({ name: 'John Doe' })
5 +}
1 +import {Header} from 'semantic-ui-react'
2 +import Head from 'next/head'
3 +
4 +export default function Home() {
5 + return (
6 + <div className=''>
7 + <Head>
8 + <title>Learn In Web</title>
9 + <meta name="description" content="Generated by create next app" />
10 + <link rel="icon" href="/favicon.ico" />
11 + </Head>
12 + {/* 기본 컨텐츠 */}
13 + <Header as='h3' textAlign='center'>인기 문제</Header>
14 +
15 + </div>
16 + )
17 +}
...\ No newline at end of file ...\ No newline at end of file
1 +import { useRouter } from "next/router";
2 +import * as auth from "../api/auth";
3 +
4 +export default function Login() {
5 + const router = useRouter();
6 +
7 + return (
8 + <div>
9 + <h1>Login</h1>
10 + <form onSubmit={handleSubmit}>
11 + <label htmlFor="email">Email</label>
12 + <input type="email" id="email" />
13 + <label htmlFor="password">Password</label>
14 + <input type="password" id="password" />
15 + <button type="submit">Login</button>
16 + </form>
17 + </div>
18 + );
19 +
20 + async function handleSubmit(event) {
21 + event.preventDefault();
22 + const form = event.target;
23 + const email = form.email.value;
24 + const password = form.password.value;
25 + const login = await auth.login(email, password);
26 + if(!login) {
27 + alert("Login failed");
28 + }
29 + return router.push("/");
30 + }
31 +}
32 +
1 +import { useRouter } from "next/dist/client/router"
2 +import { getPostbyId } from "../../api/post"
3 +
4 +
5 +export default function Post() {
6 + const router = useRouter()
7 + const { id } = router.query
8 + const post = getPostbyId(id)
9 + return (
10 + <div>
11 + <p>{post.title}</p>
12 + <p>{post.body}</p>
13 + </div>
14 + )
15 +}
...\ No newline at end of file ...\ No newline at end of file
1 +import * as auth from "../api/auth";
2 +import push from "next/router";
3 +
4 +export default function Signup() {
5 + return (
6 + <div>
7 + <h1>Signup</h1>
8 + <form onSubmit={handleSubmit}>
9 + <label htmlFor="name">Name</label>
10 + <input type="text" id="name" />
11 + <label htmlFor="email">Email</label>
12 + <input type="email" id="email" />
13 + <label htmlFor="password">Password</label>
14 + <input type="password" id="password" />
15 + <button type="submit">Signup</button>
16 + </form>
17 + </div>
18 + );
19 +}
20 +
21 +function handleSubmit(event) {
22 + event.preventDefault();
23 + const form = event.target;
24 + const name = form.name.value;
25 + const email = form.email.value;
26 + const password = form.password.value;
27 + console.log(name, email, password);
28 + const signup = auth.signup(name, email, password);
29 + if(!signup) {
30 + alert("Signup failed");
31 + }
32 + return push("/");
33 +}
...\ No newline at end of file ...\ No newline at end of file
1 -import * as child_process from "child_process";
2 -import * as fs from "fs";
3 -
4 -export class Runner {
5 - type: string;
6 - input: Array<string>;
7 - output: Array<string> = [];
8 - time: Date = new Date();
9 - constructor(req: any) {
10 - this.type = req.body.type;
11 - this.input = req.body.input;
12 - fs.writeFileSync("tmp." + this.type, req.body.code);
13 - }
14 - run() {
15 - switch (this.type) {
16 - case "c": {
17 - this.c();
18 - }
19 - case "c++": {
20 - this.cpp();
21 - }
22 - case "js": {
23 - this.js();
24 - }
25 - case "go": {
26 - this.go();
27 - }
28 - case "ts": {
29 - this.ts();
30 - }
31 - }
32 - }
33 - c() {
34 - if ((this.input = [])) {
35 - const test = child_process.spawnSync("gcc", ["~/OSS/main/tmp.c"], {
36 - encoding: "utf8",
37 - shell: true,
38 - });
39 - console.log(test.stderr);
40 - const result = child_process.spawnSync("~/OSS/main/a.out", {
41 - encoding: "utf8",
42 - shell: true,
43 - });
44 - console.log(result.stdout);
45 - this.output.push(fix(result.stdout));
46 - }
47 - for (let ip of this.input) {
48 - const test = child_process.spawnSync("gcc", ["~/OSS/main/tmp.c"], {
49 - encoding: "utf8",
50 - shell: true,
51 - });
52 - console.log(test.stderr);
53 - const result = child_process.spawnSync("~/OSS/main/a.out", {
54 - encoding: "utf8",
55 - shell: true,
56 - input: ip,
57 - });
58 - console.log(result.stdout);
59 - this.output.push(fix(result.stdout));
60 - }
61 - }
62 - cpp() {
63 - if (this.input = []) {
64 - const test = child_process.spawnSync("gcc", ["~/OSS/main/tmp.c"], {
65 - encoding: "utf8",
66 - shell: true,
67 - });
68 - console.log(test.stderr);
69 - const result = child_process.spawnSync("~/OSS/main/a.out", {
70 - encoding: "utf8",
71 - shell: true,
72 - });
73 - console.log(result.stdout);
74 - this.output.push(fix(result.stdout));
75 - }
76 - for (let ip of this.input) {
77 - const test = child_process.spawnSync("gcc", ["~/OSS/main/tmp.c"], {
78 - encoding: "utf8",
79 - shell: true,
80 - });
81 - console.log(test.stderr);
82 - const result = child_process.spawnSync("~/OSS/main/a.out", {
83 - encoding: "utf8",
84 - shell: true,
85 - input: ip,
86 - });
87 - console.log(result.stdout);
88 - this.output.push(fix(result.stdout));
89 - }
90 - }
91 - js() {
92 - if (this.input = []) {
93 - const test = child_process.spawnSync("node", ["~/OSS/main/tmp.c"], {
94 - encoding: "utf8",
95 - shell: true,
96 - });
97 - console.log(test.stdout);
98 - this.output.push(fix(test.stdout));
99 - }
100 - for (let ip of this.input) {
101 - const test = child_process.spawnSync("node", ["~/OSS/main/tmp.c"], {
102 - encoding: "utf8",
103 - shell: true,
104 - input: ip,
105 - });
106 - console.log(test.stdout);
107 - this.output.push(fix(test.stdout));
108 - }
109 - }
110 - go() {
111 - if (this.input = []) {
112 - const test = child_process.spawnSync("go", ["run", "~/OSS/main/tmp.c"], {
113 - encoding: "utf8",
114 - shell: true,
115 - });
116 - console.log(test.stdout);
117 - this.output.push(fix(test.stdout));
118 - }
119 - for (let ip of this.input) {
120 - const test = child_process.spawnSync("go", ["run", "~/OSS/main/tmp.c"], {
121 - encoding: "utf8",
122 - shell: true,
123 - input: ip,
124 - });
125 - console.log(test.stdout);
126 - this.output.push(fix(test.stdout));
127 - }
128 - }
129 - ts() {
130 - if (this.input = []) {
131 - const test = child_process.spawnSync("ts-node", ["run", "~/OSS/main/tmp.c"], {
132 - encoding: "utf8",
133 - shell: true,
134 - });
135 - console.log(test.stdout);
136 - this.output.push(fix(test.stdout));
137 - }
138 - for (let ip of this.input) {
139 - const test = child_process.spawnSync("ts-node", ["run", "~/OSS/main/tmp.c"], {
140 - encoding: "utf8",
141 - shell: true,
142 - input: ip,
143 - });
144 - console.log(test.stdout);
145 - this.output.push(fix(test.stdout));
146 - }
147 - }
148 -}
149 -
150 -const fix = (a: any): string => {
151 - if (typeof a === "string") {
152 - return a;
153 - }
154 - return "";
155 -};
1 +.container {
2 + padding: 0 2rem;
3 +}
4 +
5 +.main {
6 + min-height: 100vh;
7 + padding: 4rem 0;
8 + flex: 1;
9 + display: flex;
10 + flex-direction: column;
11 + justify-content: center;
12 + align-items: center;
13 +}
14 +
15 +.footer {
16 + display: flex;
17 + flex: 1;
18 + padding: 2rem 0;
19 + border-top: 1px solid #eaeaea;
20 + justify-content: center;
21 + align-items: center;
22 +}
23 +
24 +.footer a {
25 + display: flex;
26 + justify-content: center;
27 + align-items: center;
28 + flex-grow: 1;
29 +}
30 +
31 +.title a {
32 + color: #0070f3;
33 + text-decoration: none;
34 +}
35 +
36 +.title a:hover,
37 +.title a:focus,
38 +.title a:active {
39 + text-decoration: underline;
40 +}
41 +
42 +.title {
43 + margin: 0;
44 + line-height: 1.15;
45 + font-size: 4rem;
46 +}
47 +
48 +.title,
49 +.description {
50 + text-align: center;
51 +}
52 +
53 +.description {
54 + margin: 4rem 0;
55 + line-height: 1.5;
56 + font-size: 1.5rem;
57 +}
58 +
59 +.code {
60 + background: #fafafa;
61 + border-radius: 5px;
62 + padding: 0.75rem;
63 + font-size: 1.1rem;
64 + font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
65 + Bitstream Vera Sans Mono, Courier New, monospace;
66 +}
67 +
68 +.grid {
69 + display: flex;
70 + align-items: center;
71 + justify-content: center;
72 + flex-wrap: wrap;
73 + max-width: 800px;
74 +}
75 +
76 +.card {
77 + margin: 1rem;
78 + padding: 1.5rem;
79 + text-align: left;
80 + color: inherit;
81 + text-decoration: none;
82 + border: 1px solid #eaeaea;
83 + border-radius: 10px;
84 + transition: color 0.15s ease, border-color 0.15s ease;
85 + max-width: 300px;
86 +}
87 +
88 +.card:hover,
89 +.card:focus,
90 +.card:active {
91 + color: #0070f3;
92 + border-color: #0070f3;
93 +}
94 +
95 +.card h2 {
96 + margin: 0 0 1rem 0;
97 + font-size: 1.5rem;
98 +}
99 +
100 +.card p {
101 + margin: 0;
102 + font-size: 1.25rem;
103 + line-height: 1.5;
104 +}
105 +
106 +.logo {
107 + height: 1em;
108 + margin-left: 0.5rem;
109 +}
110 +
111 +@media (max-width: 600px) {
112 + .grid {
113 + width: 100%;
114 + flex-direction: column;
115 + }
116 +}
1 +@tailwind base;
2 +@tailwind components;
3 +@tailwind utilities;
4 +
5 +@layer base {
6 + body {
7 + @apply bg-[#06202A] text-gray-300
8 + }
9 +}
10 +
11 +html,
12 +body {
13 + padding: 0;
14 + margin: 0;
15 + font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
16 + Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
17 +}
18 +
19 +a {
20 + color: inherit;
21 + text-decoration: none;
22 +}
23 +
24 +* {
25 + box-sizing: border-box;
26 +}
1 +module.exports = {
2 + mode: 'jit',
3 + purge: ['./src/**/*.{js,ts,jsx,tsx}'],
4 + darkMode: false, // or 'media' or 'class'
5 + theme: {
6 + extend: {},
7 + },
8 + variants: {
9 + extend: {},
10 + },
11 + plugins: [],
12 +}
1 -{
2 - "compilerOptions": {
3 - /* Visit https://aka.ms/tsconfig.json to read more about this file */
4 -
5 - /* Projects */
6 - // "incremental": true, /* Enable incremental compilation */
7 - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8 - // "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
9 - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
10 - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11 - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12 -
13 - /* Language and Environment */
14 - "target": "es5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15 - "lib": ["es6","dom"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16 - // "jsx": "preserve", /* Specify what JSX code is generated. */
17 - // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
18 - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19 - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
20 - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21 - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
22 - // "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
23 - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24 - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25 -
26 - /* Modules */
27 - "module": "commonjs", /* Specify what module code is generated. */
28 - "rootDir": "src", /* Specify the root folder within your source files. */
29 - "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
30 - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
31 - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
32 - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
33 - // "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
34 - // "types": [], /* Specify type package names to be included without being referenced in a source file. */
35 - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
36 - "resolveJsonModule": true, /* Enable importing .json files */
37 - // "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
38 -
39 - /* JavaScript Support */
40 - // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
41 - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
42 - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
43 -
44 - /* Emit */
45 - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
46 - // "declarationMap": true, /* Create sourcemaps for d.ts files. */
47 - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
48 - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
49 - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
50 - "outDir": "lib", /* Specify an output folder for all emitted files. */
51 - // "removeComments": true, /* Disable emitting comments. */
52 - // "noEmit": true, /* Disable emitting files from a compilation. */
53 - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
54 - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
55 - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
56 - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
57 - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58 - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
59 - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
60 - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
61 - // "newLine": "crlf", /* Set the newline character for emitting files. */
62 - // "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
63 - // "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
64 - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
65 - // "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
66 - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
67 -
68 - /* Interop Constraints */
69 - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
70 - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
71 - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
72 - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
73 - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
74 -
75 - /* Type Checking */
76 - "strict": true, /* Enable all strict type-checking options. */
77 - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
78 - // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
79 - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
80 - // "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
81 - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
82 - // "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
83 - // "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
84 - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
85 - // "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
86 - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
87 - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
88 - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
89 - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
90 - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
91 - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
92 - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
93 - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
94 - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
95 -
96 - /* Completeness */
97 - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
98 - "skipLibCheck": true /* Skip type checking all .d.ts files. */
99 - }
100 -}
1 -<!DOCTYPE html>
2 -<html>
3 - <head>
4 - <link rel="stylesheet" href="css/style.css" />
5 - </head>
6 - <body>
7 - <div class="wrapper">
8 - <div class="header">Code in Web</div>
9 - <h1>My First Heading</h1>
10 - <p>My first paragraph.</p>
11 - </div>
12 - </body>
13 -</html>