From ad1b7abf45603f3d8be3a79370154ca97d98bb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E6=B8=8A=E5=8F=A3=E9=A6=99=E7=B3=96?= <5183454+yuanjianming666@user.noreply.gitee.com> Date: Tue, 8 Oct 2024 17:46:24 +0800 Subject: [PATCH 1/3] add: readme.md --- members/yuan66-hub/readme.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 members/yuan66-hub/readme.md diff --git a/members/yuan66-hub/readme.md b/members/yuan66-hub/readme.md new file mode 100644 index 000000000..92217b2d1 --- /dev/null +++ b/members/yuan66-hub/readme.md @@ -0,0 +1,17 @@ +# Web3 前端训练营报名 + +## 个人信息 + +* Github ID: yuan66-hub + +* Wechat ID: 13686561615 + +* Openbuild Username: ming yuan + +(首次如果没有,学习完毕钱包在填写) + +* ERC20 钱包地址: + +### 个人介绍 + +近3年web2前端开发工程师,主要技术栈(reactjs,vuejs,nextjs),入坑web3 \ No newline at end of file From 5543553ec16e2ff1f8b3e81ea7349d54d9e5f217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E6=B8=8A=E5=8F=A3=E9=A6=99=E7=B3=96?= <5183454+yuanjianming666@user.noreply.gitee.com> Date: Tue, 8 Oct 2024 18:32:31 +0800 Subject: [PATCH 2/3] task1: yuan66-hub --- members/yuan66-hub/task1/.gitignore | 24 +++++++ members/yuan66-hub/task1/README.md | 8 +++ members/yuan66-hub/task1/eslint.config.js | 38 +++++++++++ members/yuan66-hub/task1/index.html | 13 ++++ members/yuan66-hub/task1/package.json | 28 ++++++++ members/yuan66-hub/task1/public/vite.svg | 1 + members/yuan66-hub/task1/src/App.css | 42 ++++++++++++ members/yuan66-hub/task1/src/App.jsx | 41 +++++++++++ members/yuan66-hub/task1/src/assets/react.svg | 1 + .../task1/src/components/AddToDo.jsx | 6 ++ .../task1/src/components/Header.jsx | 18 +++++ .../task1/src/components/ToDoItem.jsx | 11 +++ .../task1/src/components/ToDoList.jsx | 26 +++++++ members/yuan66-hub/task1/src/index.css | 68 +++++++++++++++++++ members/yuan66-hub/task1/src/main.jsx | 9 +++ members/yuan66-hub/task1/vite.config.js | 7 ++ 16 files changed, 341 insertions(+) create mode 100644 members/yuan66-hub/task1/.gitignore create mode 100644 members/yuan66-hub/task1/README.md create mode 100644 members/yuan66-hub/task1/eslint.config.js create mode 100644 members/yuan66-hub/task1/index.html create mode 100644 members/yuan66-hub/task1/package.json create mode 100644 members/yuan66-hub/task1/public/vite.svg create mode 100644 members/yuan66-hub/task1/src/App.css create mode 100644 members/yuan66-hub/task1/src/App.jsx create mode 100644 members/yuan66-hub/task1/src/assets/react.svg create mode 100644 members/yuan66-hub/task1/src/components/AddToDo.jsx create mode 100644 members/yuan66-hub/task1/src/components/Header.jsx create mode 100644 members/yuan66-hub/task1/src/components/ToDoItem.jsx create mode 100644 members/yuan66-hub/task1/src/components/ToDoList.jsx create mode 100644 members/yuan66-hub/task1/src/index.css create mode 100644 members/yuan66-hub/task1/src/main.jsx create mode 100644 members/yuan66-hub/task1/vite.config.js diff --git a/members/yuan66-hub/task1/.gitignore b/members/yuan66-hub/task1/.gitignore new file mode 100644 index 000000000..a547bf36d --- /dev/null +++ b/members/yuan66-hub/task1/.gitignore @@ -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? diff --git a/members/yuan66-hub/task1/README.md b/members/yuan66-hub/task1/README.md new file mode 100644 index 000000000..f768e33fc --- /dev/null +++ b/members/yuan66-hub/task1/README.md @@ -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 diff --git a/members/yuan66-hub/task1/eslint.config.js b/members/yuan66-hub/task1/eslint.config.js new file mode 100644 index 000000000..238d2e4e6 --- /dev/null +++ b/members/yuan66-hub/task1/eslint.config.js @@ -0,0 +1,38 @@ +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' + +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 }, + ], + }, + }, +] diff --git a/members/yuan66-hub/task1/index.html b/members/yuan66-hub/task1/index.html new file mode 100644 index 000000000..0c589eccd --- /dev/null +++ b/members/yuan66-hub/task1/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + + +
+ + + diff --git a/members/yuan66-hub/task1/package.json b/members/yuan66-hub/task1/package.json new file mode 100644 index 000000000..050d93102 --- /dev/null +++ b/members/yuan66-hub/task1/package.json @@ -0,0 +1,28 @@ +{ + "name": "react-app", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "lint": "eslint .", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@eslint/js": "^9.11.1", + "@types/react": "^18.3.10", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react": "^4.3.2", + "eslint": "^9.11.1", + "eslint-plugin-react": "^7.37.0", + "eslint-plugin-react-hooks": "^5.1.0-rc.0", + "eslint-plugin-react-refresh": "^0.4.12", + "globals": "^15.9.0", + "vite": "^5.4.8" + } +} diff --git a/members/yuan66-hub/task1/public/vite.svg b/members/yuan66-hub/task1/public/vite.svg new file mode 100644 index 000000000..e7b8dfb1b --- /dev/null +++ b/members/yuan66-hub/task1/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/members/yuan66-hub/task1/src/App.css b/members/yuan66-hub/task1/src/App.css new file mode 100644 index 000000000..b9d355df2 --- /dev/null +++ b/members/yuan66-hub/task1/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/members/yuan66-hub/task1/src/App.jsx b/members/yuan66-hub/task1/src/App.jsx new file mode 100644 index 000000000..bd0e5ec5d --- /dev/null +++ b/members/yuan66-hub/task1/src/App.jsx @@ -0,0 +1,41 @@ +import { useEffect, useState } from 'react' +import Header from './components/Header' +import ToDoList from './components/TodoList' +function App() { + const [todoList, setTodoList] = useState([]); + useEffect(() => { + const list = localStorage.getItem('list') + setTodoList(JSON.parse(list) || []) + }, []) + + useEffect(() => { + if (todoList.length) + localStorage.setItem('list', JSON.stringify(todoList)) + }, [todoList]) + + const onAdd = (val) => { + setTodoList([...todoList, { + name: val, + status: false + }]) + + } + const onDel = (index) => { + const newTodos = todoList.filter((_, i) => i !== index * 1); + setTodoList([...newTodos]); + } + const onFinish = (index) => { + const newTodos = [...todoList]; + newTodos[index].status = !newTodos[index].status; + setTodoList(newTodos); + } + + return ( + <> +
+ + + ) +} + +export default App diff --git a/members/yuan66-hub/task1/src/assets/react.svg b/members/yuan66-hub/task1/src/assets/react.svg new file mode 100644 index 000000000..6c87de9bb --- /dev/null +++ b/members/yuan66-hub/task1/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/members/yuan66-hub/task1/src/components/AddToDo.jsx b/members/yuan66-hub/task1/src/components/AddToDo.jsx new file mode 100644 index 000000000..43d5dc791 --- /dev/null +++ b/members/yuan66-hub/task1/src/components/AddToDo.jsx @@ -0,0 +1,6 @@ + + + +export default function AddToDo({ add }) { + return +} \ No newline at end of file diff --git a/members/yuan66-hub/task1/src/components/Header.jsx b/members/yuan66-hub/task1/src/components/Header.jsx new file mode 100644 index 000000000..423cdf687 --- /dev/null +++ b/members/yuan66-hub/task1/src/components/Header.jsx @@ -0,0 +1,18 @@ + +import { useRef } from "react" + +import AddToDo from "./AddToDo" + +export default function Header({ onAdd }) { + const inputRef = useRef(null) + const add = () => { + const val = inputRef.current.value + onAdd(val) + } + return ( + <> + + + + ) +} \ No newline at end of file diff --git a/members/yuan66-hub/task1/src/components/ToDoItem.jsx b/members/yuan66-hub/task1/src/components/ToDoItem.jsx new file mode 100644 index 000000000..cb126336d --- /dev/null +++ b/members/yuan66-hub/task1/src/components/ToDoItem.jsx @@ -0,0 +1,11 @@ + + +export default function ToDoItem({ children, finish, del }) { + return ( +
  • + {children} + + +
  • + ) +} \ No newline at end of file diff --git a/members/yuan66-hub/task1/src/components/ToDoList.jsx b/members/yuan66-hub/task1/src/components/ToDoList.jsx new file mode 100644 index 000000000..43ed94315 --- /dev/null +++ b/members/yuan66-hub/task1/src/components/ToDoList.jsx @@ -0,0 +1,26 @@ + +import ToDoItem from "./ToDoItem" + +export default function ToDoList({ todoList, onFinish, onDel }) { + const finish = (index) => { + return () => { + onFinish(index) + } + } + const del = (index) => { + return () => { + onDel(index) + } + } + return ( + <> + + + ) +} \ No newline at end of file diff --git a/members/yuan66-hub/task1/src/index.css b/members/yuan66-hub/task1/src/index.css new file mode 100644 index 000000000..6119ad9a8 --- /dev/null +++ b/members/yuan66-hub/task1/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/members/yuan66-hub/task1/src/main.jsx b/members/yuan66-hub/task1/src/main.jsx new file mode 100644 index 000000000..3d9da8acd --- /dev/null +++ b/members/yuan66-hub/task1/src/main.jsx @@ -0,0 +1,9 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import App from './App.jsx' + +createRoot(document.getElementById('root')).render( + + + , +) diff --git a/members/yuan66-hub/task1/vite.config.js b/members/yuan66-hub/task1/vite.config.js new file mode 100644 index 000000000..5a33944a9 --- /dev/null +++ b/members/yuan66-hub/task1/vite.config.js @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) From 0874e82f528efe065af881f1e7219995391bf589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=B1=E6=B8=8A=E5=8F=A3=E9=A6=99=E7=B3=96?= <5183454+yuanjianming666@user.noreply.gitee.com> Date: Wed, 9 Oct 2024 11:05:23 +0800 Subject: [PATCH 3/3] task1: yuan66-hub --- members/yuan66-hub/readme.md | 17 ----------------- members/yuan66-hub/task1/src/App.jsx | 2 ++ 2 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 members/yuan66-hub/readme.md diff --git a/members/yuan66-hub/readme.md b/members/yuan66-hub/readme.md deleted file mode 100644 index 92217b2d1..000000000 --- a/members/yuan66-hub/readme.md +++ /dev/null @@ -1,17 +0,0 @@ -# Web3 前端训练营报名 - -## 个人信息 - -* Github ID: yuan66-hub - -* Wechat ID: 13686561615 - -* Openbuild Username: ming yuan - -(首次如果没有,学习完毕钱包在填写) - -* ERC20 钱包地址: - -### 个人介绍 - -近3年web2前端开发工程师,主要技术栈(reactjs,vuejs,nextjs),入坑web3 \ No newline at end of file diff --git a/members/yuan66-hub/task1/src/App.jsx b/members/yuan66-hub/task1/src/App.jsx index bd0e5ec5d..b3d89da79 100644 --- a/members/yuan66-hub/task1/src/App.jsx +++ b/members/yuan66-hub/task1/src/App.jsx @@ -1,6 +1,8 @@ import { useEffect, useState } from 'react' import Header from './components/Header' import ToDoList from './components/TodoList' + + function App() { const [todoList, setTodoList] = useState([]); useEffect(() => {