Skip to content

Commit

Permalink
start working on chapter 3/2
Browse files Browse the repository at this point in the history
  • Loading branch information
omnidan committed Sep 27, 2024
1 parent 9ec7080 commit 2cfaa3f
Show file tree
Hide file tree
Showing 21 changed files with 4,510 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Chapter03/Chapter03_1/src/user/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ export function Login() {
return (
<form onSubmit={(e) => e.preventDefault()}>
<label htmlFor='login-username'>Username: </label>
<input type='text' name='login-username' id='login-username' />
<input type='text' name='username' id='login-username' />
<br />
<label htmlFor='login-password'>Password: </label>
<input type='password' name='login-password' id='login-password' />
<input type='password' name='password' id='login-password' />
<br />
<input type='submit' value='Login' />
</form>
Expand Down
6 changes: 3 additions & 3 deletions Chapter03/Chapter03_1/src/user/Register.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ export function Register() {
return (
<form onSubmit={(e) => e.preventDefault()}>
<label htmlFor='register-username'>Username: </label>
<input type='text' name='register-username' id='register-username' />
<input type='text' name='username' id='register-username' />
<br />
<label htmlFor='register-password'>Password: </label>
<input type='password' name='register-password' id='register-password' />
<input type='password' name='password' id='register-password' />
<br />
<label htmlFor='register-password-repeat'>Repeat password: </label>
<input
type='password'
name='register-password-repeat'
name='password-repeat'
id='register-password-repeat'
/>
<br />
Expand Down
24 changes: 24 additions & 0 deletions Chapter03/Chapter03_2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions Chapter03/Chapter03_2/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
8 changes: 8 additions & 0 deletions Chapter03/Chapter03_2/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"trailingComma": "all",
"tabWidth": 2,
"printWidth": 80,
"semi": false,
"jsxSingleQuote": true,
"singleQuote": true
}
8 changes: 8 additions & 0 deletions Chapter03/Chapter03_2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
40 changes: 40 additions & 0 deletions Chapter03/Chapter03_2/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import prettierConfig from 'eslint-config-prettier'

export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: '18.3' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
prettierConfig,
]
13 changes: 13 additions & 0 deletions Chapter03/Chapter03_2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading

0 comments on commit 2cfaa3f

Please sign in to comment.