diff --git a/react/.eslintrc.cjs b/exam/react/.eslintrc.cjs similarity index 100% rename from react/.eslintrc.cjs rename to exam/react/.eslintrc.cjs diff --git a/react/.gitignore b/exam/react/.gitignore similarity index 98% rename from react/.gitignore rename to exam/react/.gitignore index 251ce6d..a547bf3 100644 --- a/react/.gitignore +++ b/exam/react/.gitignore @@ -8,6 +8,7 @@ pnpm-debug.log* lerna-debug.log* node_modules +dist dist-ssr *.local diff --git a/react/README.md b/exam/react/README.md similarity index 93% rename from react/README.md rename to exam/react/README.md index 0d6babe..e1cdc89 100644 --- a/react/README.md +++ b/exam/react/README.md @@ -19,7 +19,7 @@ export default { parserOptions: { ecmaVersion: 'latest', sourceType: 'module', - project: ['./tsconfig.json', './tsconfig.node.json'], + project: ['./tsconfig.json', './tsconfig.node.json', './tsconfig.app.json'], tsconfigRootDir: __dirname, }, } diff --git a/react/index.html b/exam/react/index.html similarity index 100% rename from react/index.html rename to exam/react/index.html diff --git a/exam/react/package.json b/exam/react/package.json new file mode 100644 index 0000000..e20a669 --- /dev/null +++ b/exam/react/package.json @@ -0,0 +1,28 @@ +{ + "name": "react", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@typescript-eslint/eslint-plugin": "^7.15.0", + "@typescript-eslint/parser": "^7.15.0", + "@vitejs/plugin-react": "^4.3.1", + "eslint": "^8.57.0", + "eslint-plugin-react-hooks": "^4.6.2", + "eslint-plugin-react-refresh": "^0.4.7", + "typescript": "^5.2.2", + "vite": "^5.3.4" + } +} diff --git a/react/dist/vite.svg b/exam/react/public/vite.svg similarity index 100% rename from react/dist/vite.svg rename to exam/react/public/vite.svg diff --git a/exam/react/src/App.css b/exam/react/src/App.css new file mode 100644 index 0000000..b9d355d --- /dev/null +++ b/exam/react/src/App.css @@ -0,0 +1,42 @@ +#root { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + text-align: center; +} + +.logo { + height: 6em; + padding: 1.5em; + will-change: filter; + transition: filter 300ms; +} +.logo:hover { + filter: drop-shadow(0 0 2em #646cffaa); +} +.logo.react:hover { + filter: drop-shadow(0 0 2em #61dafbaa); +} + +@keyframes logo-spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +@media (prefers-reduced-motion: no-preference) { + a:nth-of-type(2) .logo { + animation: logo-spin infinite 20s linear; + } +} + +.card { + padding: 2em; +} + +.read-the-docs { + color: #888; +} diff --git a/exam/react/src/App.tsx b/exam/react/src/App.tsx new file mode 100644 index 0000000..afe48ac --- /dev/null +++ b/exam/react/src/App.tsx @@ -0,0 +1,35 @@ +import { useState } from 'react' +import reactLogo from './assets/react.svg' +import viteLogo from '/vite.svg' +import './App.css' + +function App() { + const [count, setCount] = useState(0) + + return ( + <> +
+
+ Edit src/App.tsx and save to test HMR
+
+ Click on the Vite and React logos to learn more +
+ > + ) +} + +export default App diff --git a/exam/react/src/assets/react.svg b/exam/react/src/assets/react.svg new file mode 100644 index 0000000..6c87de9 --- /dev/null +++ b/exam/react/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/exam/react/src/index.css b/exam/react/src/index.css new file mode 100644 index 0000000..6119ad9 --- /dev/null +++ b/exam/react/src/index.css @@ -0,0 +1,68 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/exam/react/src/main.tsx b/exam/react/src/main.tsx new file mode 100644 index 0000000..3d7150d --- /dev/null +++ b/exam/react/src/main.tsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.tsx' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root')!).render( +