From 6b81999f6a28a5e99fc5b11cee3ccc8af0885901 Mon Sep 17 00:00:00 2001 From: macho <541842961@qq.com> Date: Fri, 13 Sep 2024 17:48:34 +0800 Subject: [PATCH 1/6] init --- members/feligo887/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 members/feligo887/README.md diff --git a/members/feligo887/README.md b/members/feligo887/README.md new file mode 100644 index 000000000..a80503587 --- /dev/null +++ b/members/feligo887/README.md @@ -0,0 +1,13 @@ +# Web3 前端训练营报名 + +## 个人信息 + +* Github ID: feligo887 + +* Openbuild Username: 541842961 + +* ERC20 钱包地址: + +### 个人介绍 + +在web2工作很久的前端开发,现在想转型到web3 From 6f07ea2d0aab0769a7b8b56e7f0637c8c9286627 Mon Sep 17 00:00:00 2001 From: macho <541842961@qq.com> Date: Fri, 13 Sep 2024 17:56:18 +0800 Subject: [PATCH 2/6] init: init --- members/feligo887/task1/.gitignore | 24 +++++++ members/feligo887/task1/README.md | 50 ++++++++++++++ members/feligo887/task1/eslint.config.js | 28 ++++++++ members/feligo887/task1/index.html | 13 ++++ members/feligo887/task1/package.json | 29 +++++++++ members/feligo887/task1/public/vite.svg | 1 + members/feligo887/task1/src/App.css | 42 ++++++++++++ members/feligo887/task1/src/App.tsx | 35 ++++++++++ members/feligo887/task1/src/assets/react.svg | 1 + members/feligo887/task1/src/index.css | 68 ++++++++++++++++++++ members/feligo887/task1/src/main.tsx | 10 +++ members/feligo887/task1/src/vite-env.d.ts | 1 + members/feligo887/task1/tsconfig.app.json | 24 +++++++ members/feligo887/task1/tsconfig.json | 7 ++ members/feligo887/task1/tsconfig.node.json | 22 +++++++ members/feligo887/task1/vite.config.ts | 7 ++ 16 files changed, 362 insertions(+) create mode 100644 members/feligo887/task1/.gitignore create mode 100644 members/feligo887/task1/README.md create mode 100644 members/feligo887/task1/eslint.config.js create mode 100644 members/feligo887/task1/index.html create mode 100644 members/feligo887/task1/package.json create mode 100644 members/feligo887/task1/public/vite.svg create mode 100644 members/feligo887/task1/src/App.css create mode 100644 members/feligo887/task1/src/App.tsx create mode 100644 members/feligo887/task1/src/assets/react.svg create mode 100644 members/feligo887/task1/src/index.css create mode 100644 members/feligo887/task1/src/main.tsx create mode 100644 members/feligo887/task1/src/vite-env.d.ts create mode 100644 members/feligo887/task1/tsconfig.app.json create mode 100644 members/feligo887/task1/tsconfig.json create mode 100644 members/feligo887/task1/tsconfig.node.json create mode 100644 members/feligo887/task1/vite.config.ts diff --git a/members/feligo887/task1/.gitignore b/members/feligo887/task1/.gitignore new file mode 100644 index 000000000..a547bf36d --- /dev/null +++ b/members/feligo887/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/feligo887/task1/README.md b/members/feligo887/task1/README.md new file mode 100644 index 000000000..74872fd4a --- /dev/null +++ b/members/feligo887/task1/README.md @@ -0,0 +1,50 @@ +# React + TypeScript + 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 + +## Expanding the ESLint configuration + +If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: + +- Configure the top-level `parserOptions` property like this: + +```js +export default tseslint.config({ + languageOptions: { + // other options... + parserOptions: { + project: ['./tsconfig.node.json', './tsconfig.app.json'], + tsconfigRootDir: import.meta.dirname, + }, + }, +}) +``` + +- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` +- Optionally add `...tseslint.configs.stylisticTypeChecked` +- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: + +```js +// eslint.config.js +import react from 'eslint-plugin-react' + +export default tseslint.config({ + // Set the react version + settings: { react: { version: '18.3' } }, + plugins: { + // Add the react plugin + react, + }, + rules: { + // other rules... + // Enable its recommended rules + ...react.configs.recommended.rules, + ...react.configs['jsx-runtime'].rules, + }, +}) +``` diff --git a/members/feligo887/task1/eslint.config.js b/members/feligo887/task1/eslint.config.js new file mode 100644 index 000000000..092408a9f --- /dev/null +++ b/members/feligo887/task1/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js' +import globals from 'globals' +import reactHooks from 'eslint-plugin-react-hooks' +import reactRefresh from 'eslint-plugin-react-refresh' +import tseslint from 'typescript-eslint' + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +) diff --git a/members/feligo887/task1/index.html b/members/feligo887/task1/index.html new file mode 100644 index 000000000..e4b78eae1 --- /dev/null +++ b/members/feligo887/task1/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + TS + + +
+ + + diff --git a/members/feligo887/task1/package.json b/members/feligo887/task1/package.json new file mode 100644 index 000000000..2e91b1c4f --- /dev/null +++ b/members/feligo887/task1/package.json @@ -0,0 +1,29 @@ +{ + "name": "vite-project", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint .", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@eslint/js": "^9.9.0", + "@types/react": "^18.3.3", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react": "^4.3.1", + "eslint": "^9.9.0", + "eslint-plugin-react-hooks": "^5.1.0-rc.0", + "eslint-plugin-react-refresh": "^0.4.9", + "globals": "^15.9.0", + "typescript": "^5.5.3", + "typescript-eslint": "^8.0.1", + "vite": "^5.4.1" + } +} diff --git a/members/feligo887/task1/public/vite.svg b/members/feligo887/task1/public/vite.svg new file mode 100644 index 000000000..e7b8dfb1b --- /dev/null +++ b/members/feligo887/task1/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/members/feligo887/task1/src/App.css b/members/feligo887/task1/src/App.css new file mode 100644 index 000000000..b9d355df2 --- /dev/null +++ b/members/feligo887/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/feligo887/task1/src/App.tsx b/members/feligo887/task1/src/App.tsx new file mode 100644 index 000000000..afe48ac75 --- /dev/null +++ b/members/feligo887/task1/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 ( + <> +
+ + Vite logo + + + React logo + +
+

Vite + React

+
+ +

+ 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/members/feligo887/task1/src/assets/react.svg b/members/feligo887/task1/src/assets/react.svg new file mode 100644 index 000000000..6c87de9bb --- /dev/null +++ b/members/feligo887/task1/src/assets/react.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/members/feligo887/task1/src/index.css b/members/feligo887/task1/src/index.css new file mode 100644 index 000000000..6119ad9a8 --- /dev/null +++ b/members/feligo887/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/feligo887/task1/src/main.tsx b/members/feligo887/task1/src/main.tsx new file mode 100644 index 000000000..6f4ac9bcc --- /dev/null +++ b/members/feligo887/task1/src/main.tsx @@ -0,0 +1,10 @@ +import { StrictMode } from 'react' +import { createRoot } from 'react-dom/client' +import App from './App.tsx' +import './index.css' + +createRoot(document.getElementById('root')!).render( + + + , +) diff --git a/members/feligo887/task1/src/vite-env.d.ts b/members/feligo887/task1/src/vite-env.d.ts new file mode 100644 index 000000000..11f02fe2a --- /dev/null +++ b/members/feligo887/task1/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/members/feligo887/task1/tsconfig.app.json b/members/feligo887/task1/tsconfig.app.json new file mode 100644 index 000000000..f0a235055 --- /dev/null +++ b/members/feligo887/task1/tsconfig.app.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"] +} diff --git a/members/feligo887/task1/tsconfig.json b/members/feligo887/task1/tsconfig.json new file mode 100644 index 000000000..1ffef600d --- /dev/null +++ b/members/feligo887/task1/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/members/feligo887/task1/tsconfig.node.json b/members/feligo887/task1/tsconfig.node.json new file mode 100644 index 000000000..0d3d71446 --- /dev/null +++ b/members/feligo887/task1/tsconfig.node.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["vite.config.ts"] +} diff --git a/members/feligo887/task1/vite.config.ts b/members/feligo887/task1/vite.config.ts new file mode 100644 index 000000000..5a33944a9 --- /dev/null +++ b/members/feligo887/task1/vite.config.ts @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) From e2b6feb0735ba1fc12e20abea741cb2c6658e9a2 Mon Sep 17 00:00:00 2001 From: macho <541842961@qq.com> Date: Sat, 14 Sep 2024 17:59:59 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E6=8F=90=E4=BA=A4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- members/feligo887/task1/package.json | 7 ++- members/feligo887/task1/src/App.css | 42 ---------------- members/feligo887/task1/src/App.tsx | 33 ++++--------- .../task1/src/components/AddToDo/index.tsx | 22 +++++++++ .../task1/src/components/Header/index.tsx | 9 ++++ .../task1/src/components/ToDoList/index.tsx | 40 ++++++++++++++++ .../src/components/ToDoList/style.module.css | 23 +++++++++ members/feligo887/task1/src/main.tsx | 2 +- members/feligo887/task1/src/store/index.ts | 8 ++++ .../task1/src/store/modules/index.ts | 1 + .../task1/src/store/modules/toDoList.ts | 35 ++++++++++++++ members/feligo887/task1/src/style/reset.css | 48 +++++++++++++++++++ members/feligo887/task1/vite.config.ts | 3 ++ package.json | 9 +--- 14 files changed, 205 insertions(+), 77 deletions(-) delete mode 100644 members/feligo887/task1/src/App.css create mode 100644 members/feligo887/task1/src/components/AddToDo/index.tsx create mode 100644 members/feligo887/task1/src/components/Header/index.tsx create mode 100644 members/feligo887/task1/src/components/ToDoList/index.tsx create mode 100644 members/feligo887/task1/src/components/ToDoList/style.module.css create mode 100644 members/feligo887/task1/src/store/index.ts create mode 100644 members/feligo887/task1/src/store/modules/index.ts create mode 100644 members/feligo887/task1/src/store/modules/toDoList.ts create mode 100644 members/feligo887/task1/src/style/reset.css diff --git a/members/feligo887/task1/package.json b/members/feligo887/task1/package.json index 2e91b1c4f..12345696f 100644 --- a/members/feligo887/task1/package.json +++ b/members/feligo887/task1/package.json @@ -10,8 +10,13 @@ "preview": "vite preview" }, "dependencies": { + "@emotion/react": "^11.13.3", + "@emotion/styled": "^11.13.0", + "@mui/icons-material": "^6.1.0", + "@mui/material": "^6.1.0", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "valtio": "^2.0.0" }, "devDependencies": { "@eslint/js": "^9.9.0", diff --git a/members/feligo887/task1/src/App.css b/members/feligo887/task1/src/App.css deleted file mode 100644 index b9d355df2..000000000 --- a/members/feligo887/task1/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -#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/feligo887/task1/src/App.tsx b/members/feligo887/task1/src/App.tsx index afe48ac75..757ea107a 100644 --- a/members/feligo887/task1/src/App.tsx +++ b/members/feligo887/task1/src/App.tsx @@ -1,34 +1,17 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' -import './App.css' +import Header from './components/Header' +import AddToDo from './components/AddToDo' +import ToDoList from './components/ToDoList' function App() { - const [count, setCount] = useState(0) return ( - <> +
- - Vite logo - - - React logo - +
+ +
-

Vite + React

-
- -

- Edit src/App.tsx and save to test HMR -

-
-

- Click on the Vite and React logos to learn more -

- +
) } diff --git a/members/feligo887/task1/src/components/AddToDo/index.tsx b/members/feligo887/task1/src/components/AddToDo/index.tsx new file mode 100644 index 000000000..2ce883b40 --- /dev/null +++ b/members/feligo887/task1/src/components/AddToDo/index.tsx @@ -0,0 +1,22 @@ +import { useState } from 'react' +import { Input, Button } from '@mui/material' + +import { addToDoList } from '../../store/modules/toDoList.ts' + +const AddToDo = () => { + const [ inpVal, setInpVal ] = useState( '' ) + const handleButton = () => { + addToDoList( inpVal ) + setInpVal( '' ) + } + + return ( +
+ ) => setInpVal( event.target.value ) }/> + +
+ ) +} + +export default AddToDo diff --git a/members/feligo887/task1/src/components/Header/index.tsx b/members/feligo887/task1/src/components/Header/index.tsx new file mode 100644 index 000000000..b72826511 --- /dev/null +++ b/members/feligo887/task1/src/components/Header/index.tsx @@ -0,0 +1,9 @@ +const Header = () => { + return ( +

+ To Do List +

+ ) +} + +export default Header \ No newline at end of file diff --git a/members/feligo887/task1/src/components/ToDoList/index.tsx b/members/feligo887/task1/src/components/ToDoList/index.tsx new file mode 100644 index 000000000..893357cb8 --- /dev/null +++ b/members/feligo887/task1/src/components/ToDoList/index.tsx @@ -0,0 +1,40 @@ +import { Checkbox } from '@mui/material' +import { DeleteForever } from '@mui/icons-material' + +// store +import { useSnapshot } from 'valtio' +import store from '../../store' +import { removeToDoList, changeToDoList } from '../../store/modules/toDoList.ts' +// style +import style from './style.module.css' +// type +import type { ToDoList } from '../../store/modules/toDoList.ts' + +const ToDoItem = ( props: { item: ToDoList['list'][0], index: number } ) => { + const { item, index } = props + return ( +
  • + changeToDoList( index ) }/> + { item.text } + removeToDoList( index ) }/> +
  • + ) +} + +const ToDoList = () => { + const snapshot = useSnapshot( store ) + const { toDoList } = snapshot + return ( + + ) +} + +export default ToDoList diff --git a/members/feligo887/task1/src/components/ToDoList/style.module.css b/members/feligo887/task1/src/components/ToDoList/style.module.css new file mode 100644 index 000000000..ce841bffb --- /dev/null +++ b/members/feligo887/task1/src/components/ToDoList/style.module.css @@ -0,0 +1,23 @@ +.to-do-item { + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 8px; + padding-right: 8px; + position: relative; +} +.to-do-item::after { + content: ''; + display: block; + width: 0; + height: 1px; + background-color: #666; + position: absolute; + top: 50%; + left: 0; + transform: translateY(-50%); + transition: all 0.3s; +} +.to-do-item.check::after { + width: 100%; +} diff --git a/members/feligo887/task1/src/main.tsx b/members/feligo887/task1/src/main.tsx index 6f4ac9bcc..79346cf8b 100644 --- a/members/feligo887/task1/src/main.tsx +++ b/members/feligo887/task1/src/main.tsx @@ -1,7 +1,7 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' import App from './App.tsx' -import './index.css' +import './style/reset.css' createRoot(document.getElementById('root')!).render( diff --git a/members/feligo887/task1/src/store/index.ts b/members/feligo887/task1/src/store/index.ts new file mode 100644 index 000000000..6a4d5efe5 --- /dev/null +++ b/members/feligo887/task1/src/store/index.ts @@ -0,0 +1,8 @@ +import { proxy } from 'valtio' +import { toDoList } from './modules/toDoList.ts' + +const store = proxy({ + toDoList +}) + +export default store diff --git a/members/feligo887/task1/src/store/modules/index.ts b/members/feligo887/task1/src/store/modules/index.ts new file mode 100644 index 000000000..1c9ec27f6 --- /dev/null +++ b/members/feligo887/task1/src/store/modules/index.ts @@ -0,0 +1 @@ +export { toDoList as default } from './toDoList' diff --git a/members/feligo887/task1/src/store/modules/toDoList.ts b/members/feligo887/task1/src/store/modules/toDoList.ts new file mode 100644 index 000000000..e50299091 --- /dev/null +++ b/members/feligo887/task1/src/store/modules/toDoList.ts @@ -0,0 +1,35 @@ +import { proxy, subscribe } from 'valtio' + +export interface ToDoList { + list: Array<{ isChecked: boolean, text: string }> +} + +const loadState = () => { + const toDoList = localStorage.getItem( 'toDoList' ) + return toDoList ? JSON.parse( toDoList ) : { list: [] } +} + +// store +export const toDoList = proxy( loadState() ) + +// 增加数据 +export const addToDoList = ( text: string ) => { + toDoList.list.push( { + isChecked: false, + text, + } ) +} +// 修改数据选中状态数据 +export const changeToDoList = ( index: number ) => { + const record = toDoList.list[ index ] + record.isChecked = !record.isChecked + toDoList.list[ index ] = record +} +// 删除数据 +export const removeToDoList = ( index: number ) => { + toDoList.list.splice( index, 1 ) +} + +subscribe( toDoList, () => { + localStorage.setItem( 'toDoList', JSON.stringify( toDoList ) ) +} ) diff --git a/members/feligo887/task1/src/style/reset.css b/members/feligo887/task1/src/style/reset.css new file mode 100644 index 000000000..59a52051c --- /dev/null +++ b/members/feligo887/task1/src/style/reset.css @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/members/feligo887/task1/vite.config.ts b/members/feligo887/task1/vite.config.ts index 5a33944a9..8394b47c2 100644 --- a/members/feligo887/task1/vite.config.ts +++ b/members/feligo887/task1/vite.config.ts @@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + server: { + port: 1753 + } }) diff --git a/package.json b/package.json index 8b3d00976..c050b0456 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,7 @@ { "name": "@openbuild/web3-frontend-bootcamp", "private": true, - "devDependencies": { - "@knosys/sdk": "^0.0.3", - "@ntks/toolbox": "^0.0.6", - "dayjs": "^1.11.12", - "dotenv": "^16.4.5", - "ksio": "^0.0.3", - "octokit": "^4.0.2" - }, + "devDependencies": {}, "scripts": { "pmc": "node .knosys/scripts pmc", "site": "node .knosys/scripts site", From 6b9acd5e87d76d8b9f393257abfa2d2db05ea4b3 Mon Sep 17 00:00:00 2001 From: macho <541842961@qq.com> Date: Sat, 14 Sep 2024 17:59:59 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix=EF=BC=9A=20=E4=BF=AE=E6=94=B9name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- members/feligo887/README.md | 2 +- members/feligo887/task1/package.json | 7 ++- members/feligo887/task1/src/App.css | 42 ---------------- members/feligo887/task1/src/App.tsx | 33 ++++--------- .../task1/src/components/AddToDo/index.tsx | 22 +++++++++ .../task1/src/components/Header/index.tsx | 9 ++++ .../task1/src/components/ToDoList/index.tsx | 40 ++++++++++++++++ .../src/components/ToDoList/style.module.css | 23 +++++++++ members/feligo887/task1/src/main.tsx | 2 +- members/feligo887/task1/src/store/index.ts | 8 ++++ .../task1/src/store/modules/index.ts | 1 + .../task1/src/store/modules/toDoList.ts | 35 ++++++++++++++ members/feligo887/task1/src/style/reset.css | 48 +++++++++++++++++++ members/feligo887/task1/vite.config.ts | 3 ++ package.json | 9 +--- 15 files changed, 206 insertions(+), 78 deletions(-) delete mode 100644 members/feligo887/task1/src/App.css create mode 100644 members/feligo887/task1/src/components/AddToDo/index.tsx create mode 100644 members/feligo887/task1/src/components/Header/index.tsx create mode 100644 members/feligo887/task1/src/components/ToDoList/index.tsx create mode 100644 members/feligo887/task1/src/components/ToDoList/style.module.css create mode 100644 members/feligo887/task1/src/store/index.ts create mode 100644 members/feligo887/task1/src/store/modules/index.ts create mode 100644 members/feligo887/task1/src/store/modules/toDoList.ts create mode 100644 members/feligo887/task1/src/style/reset.css diff --git a/members/feligo887/README.md b/members/feligo887/README.md index a80503587..1c9934e42 100644 --- a/members/feligo887/README.md +++ b/members/feligo887/README.md @@ -4,7 +4,7 @@ * Github ID: feligo887 -* Openbuild Username: 541842961 +* Openbuild Username: GHQysdV5 * ERC20 钱包地址: diff --git a/members/feligo887/task1/package.json b/members/feligo887/task1/package.json index 2e91b1c4f..12345696f 100644 --- a/members/feligo887/task1/package.json +++ b/members/feligo887/task1/package.json @@ -10,8 +10,13 @@ "preview": "vite preview" }, "dependencies": { + "@emotion/react": "^11.13.3", + "@emotion/styled": "^11.13.0", + "@mui/icons-material": "^6.1.0", + "@mui/material": "^6.1.0", "react": "^18.3.1", - "react-dom": "^18.3.1" + "react-dom": "^18.3.1", + "valtio": "^2.0.0" }, "devDependencies": { "@eslint/js": "^9.9.0", diff --git a/members/feligo887/task1/src/App.css b/members/feligo887/task1/src/App.css deleted file mode 100644 index b9d355df2..000000000 --- a/members/feligo887/task1/src/App.css +++ /dev/null @@ -1,42 +0,0 @@ -#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/feligo887/task1/src/App.tsx b/members/feligo887/task1/src/App.tsx index afe48ac75..757ea107a 100644 --- a/members/feligo887/task1/src/App.tsx +++ b/members/feligo887/task1/src/App.tsx @@ -1,34 +1,17 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from '/vite.svg' -import './App.css' +import Header from './components/Header' +import AddToDo from './components/AddToDo' +import ToDoList from './components/ToDoList' function App() { - const [count, setCount] = useState(0) return ( - <> +
    - - Vite logo - - - React logo - +
    + +
    -

    Vite + React

    -
    - -

    - Edit src/App.tsx and save to test HMR -

    -
    -

    - Click on the Vite and React logos to learn more -

    - +
    ) } diff --git a/members/feligo887/task1/src/components/AddToDo/index.tsx b/members/feligo887/task1/src/components/AddToDo/index.tsx new file mode 100644 index 000000000..2ce883b40 --- /dev/null +++ b/members/feligo887/task1/src/components/AddToDo/index.tsx @@ -0,0 +1,22 @@ +import { useState } from 'react' +import { Input, Button } from '@mui/material' + +import { addToDoList } from '../../store/modules/toDoList.ts' + +const AddToDo = () => { + const [ inpVal, setInpVal ] = useState( '' ) + const handleButton = () => { + addToDoList( inpVal ) + setInpVal( '' ) + } + + return ( +
    + ) => setInpVal( event.target.value ) }/> + +
    + ) +} + +export default AddToDo diff --git a/members/feligo887/task1/src/components/Header/index.tsx b/members/feligo887/task1/src/components/Header/index.tsx new file mode 100644 index 000000000..b72826511 --- /dev/null +++ b/members/feligo887/task1/src/components/Header/index.tsx @@ -0,0 +1,9 @@ +const Header = () => { + return ( +

    + To Do List +

    + ) +} + +export default Header \ No newline at end of file diff --git a/members/feligo887/task1/src/components/ToDoList/index.tsx b/members/feligo887/task1/src/components/ToDoList/index.tsx new file mode 100644 index 000000000..893357cb8 --- /dev/null +++ b/members/feligo887/task1/src/components/ToDoList/index.tsx @@ -0,0 +1,40 @@ +import { Checkbox } from '@mui/material' +import { DeleteForever } from '@mui/icons-material' + +// store +import { useSnapshot } from 'valtio' +import store from '../../store' +import { removeToDoList, changeToDoList } from '../../store/modules/toDoList.ts' +// style +import style from './style.module.css' +// type +import type { ToDoList } from '../../store/modules/toDoList.ts' + +const ToDoItem = ( props: { item: ToDoList['list'][0], index: number } ) => { + const { item, index } = props + return ( +
  • + changeToDoList( index ) }/> + { item.text } + removeToDoList( index ) }/> +
  • + ) +} + +const ToDoList = () => { + const snapshot = useSnapshot( store ) + const { toDoList } = snapshot + return ( +
      + { + toDoList.list.map( ( item, index ) => { + return ( + + ) + } ) + } +
    + ) +} + +export default ToDoList diff --git a/members/feligo887/task1/src/components/ToDoList/style.module.css b/members/feligo887/task1/src/components/ToDoList/style.module.css new file mode 100644 index 000000000..ce841bffb --- /dev/null +++ b/members/feligo887/task1/src/components/ToDoList/style.module.css @@ -0,0 +1,23 @@ +.to-do-item { + display: flex; + align-items: center; + justify-content: space-between; + margin-top: 8px; + padding-right: 8px; + position: relative; +} +.to-do-item::after { + content: ''; + display: block; + width: 0; + height: 1px; + background-color: #666; + position: absolute; + top: 50%; + left: 0; + transform: translateY(-50%); + transition: all 0.3s; +} +.to-do-item.check::after { + width: 100%; +} diff --git a/members/feligo887/task1/src/main.tsx b/members/feligo887/task1/src/main.tsx index 6f4ac9bcc..79346cf8b 100644 --- a/members/feligo887/task1/src/main.tsx +++ b/members/feligo887/task1/src/main.tsx @@ -1,7 +1,7 @@ import { StrictMode } from 'react' import { createRoot } from 'react-dom/client' import App from './App.tsx' -import './index.css' +import './style/reset.css' createRoot(document.getElementById('root')!).render( diff --git a/members/feligo887/task1/src/store/index.ts b/members/feligo887/task1/src/store/index.ts new file mode 100644 index 000000000..6a4d5efe5 --- /dev/null +++ b/members/feligo887/task1/src/store/index.ts @@ -0,0 +1,8 @@ +import { proxy } from 'valtio' +import { toDoList } from './modules/toDoList.ts' + +const store = proxy({ + toDoList +}) + +export default store diff --git a/members/feligo887/task1/src/store/modules/index.ts b/members/feligo887/task1/src/store/modules/index.ts new file mode 100644 index 000000000..1c9ec27f6 --- /dev/null +++ b/members/feligo887/task1/src/store/modules/index.ts @@ -0,0 +1 @@ +export { toDoList as default } from './toDoList' diff --git a/members/feligo887/task1/src/store/modules/toDoList.ts b/members/feligo887/task1/src/store/modules/toDoList.ts new file mode 100644 index 000000000..e50299091 --- /dev/null +++ b/members/feligo887/task1/src/store/modules/toDoList.ts @@ -0,0 +1,35 @@ +import { proxy, subscribe } from 'valtio' + +export interface ToDoList { + list: Array<{ isChecked: boolean, text: string }> +} + +const loadState = () => { + const toDoList = localStorage.getItem( 'toDoList' ) + return toDoList ? JSON.parse( toDoList ) : { list: [] } +} + +// store +export const toDoList = proxy( loadState() ) + +// 增加数据 +export const addToDoList = ( text: string ) => { + toDoList.list.push( { + isChecked: false, + text, + } ) +} +// 修改数据选中状态数据 +export const changeToDoList = ( index: number ) => { + const record = toDoList.list[ index ] + record.isChecked = !record.isChecked + toDoList.list[ index ] = record +} +// 删除数据 +export const removeToDoList = ( index: number ) => { + toDoList.list.splice( index, 1 ) +} + +subscribe( toDoList, () => { + localStorage.setItem( 'toDoList', JSON.stringify( toDoList ) ) +} ) diff --git a/members/feligo887/task1/src/style/reset.css b/members/feligo887/task1/src/style/reset.css new file mode 100644 index 000000000..59a52051c --- /dev/null +++ b/members/feligo887/task1/src/style/reset.css @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/members/feligo887/task1/vite.config.ts b/members/feligo887/task1/vite.config.ts index 5a33944a9..8394b47c2 100644 --- a/members/feligo887/task1/vite.config.ts +++ b/members/feligo887/task1/vite.config.ts @@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react' // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + server: { + port: 1753 + } }) diff --git a/package.json b/package.json index 8b3d00976..c050b0456 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,7 @@ { "name": "@openbuild/web3-frontend-bootcamp", "private": true, - "devDependencies": { - "@knosys/sdk": "^0.0.3", - "@ntks/toolbox": "^0.0.6", - "dayjs": "^1.11.12", - "dotenv": "^16.4.5", - "ksio": "^0.0.3", - "octokit": "^4.0.2" - }, + "devDependencies": {}, "scripts": { "pmc": "node .knosys/scripts pmc", "site": "node .knosys/scripts site", From ef6a2891df91e37782e5ac1ab4ee92ff107117bb Mon Sep 17 00:00:00 2001 From: macho <541842961@qq.com> Date: Wed, 18 Sep 2024 09:55:32 +0800 Subject: [PATCH 5/6] fate --- members/feligo887/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/members/feligo887/README.md b/members/feligo887/README.md index 1c9934e42..eb484f57b 100644 --- a/members/feligo887/README.md +++ b/members/feligo887/README.md @@ -6,7 +6,7 @@ * Openbuild Username: GHQysdV5 -* ERC20 钱包地址: +* ERC20 钱包地址: (无) ### 个人介绍 From fec67ceb9c99ecd805552821dcec4badd2f5a134 Mon Sep 17 00:00:00 2001 From: macho <541842961@qq.com> Date: Mon, 23 Sep 2024 17:18:13 +0800 Subject: [PATCH 6/6] =?UTF-8?q?revert:=20=E5=9B=9E=E9=80=80package=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- members/feligo887/task1/.gitignore | 24 ------- members/feligo887/task1/README.md | 50 -------------- members/feligo887/task1/eslint.config.js | 28 -------- members/feligo887/task1/index.html | 13 ---- members/feligo887/task1/package.json | 34 ---------- members/feligo887/task1/public/vite.svg | 1 - members/feligo887/task1/src/App.tsx | 18 ----- members/feligo887/task1/src/assets/react.svg | 1 - .../task1/src/components/AddToDo/index.tsx | 22 ------ .../task1/src/components/Header/index.tsx | 9 --- .../task1/src/components/ToDoList/index.tsx | 40 ----------- .../src/components/ToDoList/style.module.css | 23 ------- members/feligo887/task1/src/index.css | 68 ------------------- members/feligo887/task1/src/main.tsx | 10 --- members/feligo887/task1/src/store/index.ts | 8 --- .../task1/src/store/modules/index.ts | 1 - .../task1/src/store/modules/toDoList.ts | 35 ---------- members/feligo887/task1/src/style/reset.css | 48 ------------- members/feligo887/task1/src/vite-env.d.ts | 1 - members/feligo887/task1/tsconfig.app.json | 24 ------- members/feligo887/task1/tsconfig.json | 7 -- members/feligo887/task1/tsconfig.node.json | 22 ------ members/feligo887/task1/vite.config.ts | 10 --- package.json | 9 ++- 24 files changed, 8 insertions(+), 498 deletions(-) delete mode 100644 members/feligo887/task1/.gitignore delete mode 100644 members/feligo887/task1/README.md delete mode 100644 members/feligo887/task1/eslint.config.js delete mode 100644 members/feligo887/task1/index.html delete mode 100644 members/feligo887/task1/package.json delete mode 100644 members/feligo887/task1/public/vite.svg delete mode 100644 members/feligo887/task1/src/App.tsx delete mode 100644 members/feligo887/task1/src/assets/react.svg delete mode 100644 members/feligo887/task1/src/components/AddToDo/index.tsx delete mode 100644 members/feligo887/task1/src/components/Header/index.tsx delete mode 100644 members/feligo887/task1/src/components/ToDoList/index.tsx delete mode 100644 members/feligo887/task1/src/components/ToDoList/style.module.css delete mode 100644 members/feligo887/task1/src/index.css delete mode 100644 members/feligo887/task1/src/main.tsx delete mode 100644 members/feligo887/task1/src/store/index.ts delete mode 100644 members/feligo887/task1/src/store/modules/index.ts delete mode 100644 members/feligo887/task1/src/store/modules/toDoList.ts delete mode 100644 members/feligo887/task1/src/style/reset.css delete mode 100644 members/feligo887/task1/src/vite-env.d.ts delete mode 100644 members/feligo887/task1/tsconfig.app.json delete mode 100644 members/feligo887/task1/tsconfig.json delete mode 100644 members/feligo887/task1/tsconfig.node.json delete mode 100644 members/feligo887/task1/vite.config.ts diff --git a/members/feligo887/task1/.gitignore b/members/feligo887/task1/.gitignore deleted file mode 100644 index a547bf36d..000000000 --- a/members/feligo887/task1/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# 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/feligo887/task1/README.md b/members/feligo887/task1/README.md deleted file mode 100644 index 74872fd4a..000000000 --- a/members/feligo887/task1/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# React + TypeScript + 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 - -## Expanding the ESLint configuration - -If you are developing a production application, we recommend updating the configuration to enable type aware lint rules: - -- Configure the top-level `parserOptions` property like this: - -```js -export default tseslint.config({ - languageOptions: { - // other options... - parserOptions: { - project: ['./tsconfig.node.json', './tsconfig.app.json'], - tsconfigRootDir: import.meta.dirname, - }, - }, -}) -``` - -- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked` -- Optionally add `...tseslint.configs.stylisticTypeChecked` -- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config: - -```js -// eslint.config.js -import react from 'eslint-plugin-react' - -export default tseslint.config({ - // Set the react version - settings: { react: { version: '18.3' } }, - plugins: { - // Add the react plugin - react, - }, - rules: { - // other rules... - // Enable its recommended rules - ...react.configs.recommended.rules, - ...react.configs['jsx-runtime'].rules, - }, -}) -``` diff --git a/members/feligo887/task1/eslint.config.js b/members/feligo887/task1/eslint.config.js deleted file mode 100644 index 092408a9f..000000000 --- a/members/feligo887/task1/eslint.config.js +++ /dev/null @@ -1,28 +0,0 @@ -import js from '@eslint/js' -import globals from 'globals' -import reactHooks from 'eslint-plugin-react-hooks' -import reactRefresh from 'eslint-plugin-react-refresh' -import tseslint from 'typescript-eslint' - -export default tseslint.config( - { ignores: ['dist'] }, - { - extends: [js.configs.recommended, ...tseslint.configs.recommended], - files: ['**/*.{ts,tsx}'], - languageOptions: { - ecmaVersion: 2020, - globals: globals.browser, - }, - plugins: { - 'react-hooks': reactHooks, - 'react-refresh': reactRefresh, - }, - rules: { - ...reactHooks.configs.recommended.rules, - 'react-refresh/only-export-components': [ - 'warn', - { allowConstantExport: true }, - ], - }, - }, -) diff --git a/members/feligo887/task1/index.html b/members/feligo887/task1/index.html deleted file mode 100644 index e4b78eae1..000000000 --- a/members/feligo887/task1/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - Vite + React + TS - - -
    - - - diff --git a/members/feligo887/task1/package.json b/members/feligo887/task1/package.json deleted file mode 100644 index 12345696f..000000000 --- a/members/feligo887/task1/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "vite-project", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "tsc -b && vite build", - "lint": "eslint .", - "preview": "vite preview" - }, - "dependencies": { - "@emotion/react": "^11.13.3", - "@emotion/styled": "^11.13.0", - "@mui/icons-material": "^6.1.0", - "@mui/material": "^6.1.0", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "valtio": "^2.0.0" - }, - "devDependencies": { - "@eslint/js": "^9.9.0", - "@types/react": "^18.3.3", - "@types/react-dom": "^18.3.0", - "@vitejs/plugin-react": "^4.3.1", - "eslint": "^9.9.0", - "eslint-plugin-react-hooks": "^5.1.0-rc.0", - "eslint-plugin-react-refresh": "^0.4.9", - "globals": "^15.9.0", - "typescript": "^5.5.3", - "typescript-eslint": "^8.0.1", - "vite": "^5.4.1" - } -} diff --git a/members/feligo887/task1/public/vite.svg b/members/feligo887/task1/public/vite.svg deleted file mode 100644 index e7b8dfb1b..000000000 --- a/members/feligo887/task1/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/members/feligo887/task1/src/App.tsx b/members/feligo887/task1/src/App.tsx deleted file mode 100644 index 757ea107a..000000000 --- a/members/feligo887/task1/src/App.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import Header from './components/Header' -import AddToDo from './components/AddToDo' -import ToDoList from './components/ToDoList' - -function App() { - - return ( -
    -
    -
    - - -
    -
    - ) -} - -export default App diff --git a/members/feligo887/task1/src/assets/react.svg b/members/feligo887/task1/src/assets/react.svg deleted file mode 100644 index 6c87de9bb..000000000 --- a/members/feligo887/task1/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/members/feligo887/task1/src/components/AddToDo/index.tsx b/members/feligo887/task1/src/components/AddToDo/index.tsx deleted file mode 100644 index 2ce883b40..000000000 --- a/members/feligo887/task1/src/components/AddToDo/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { useState } from 'react' -import { Input, Button } from '@mui/material' - -import { addToDoList } from '../../store/modules/toDoList.ts' - -const AddToDo = () => { - const [ inpVal, setInpVal ] = useState( '' ) - const handleButton = () => { - addToDoList( inpVal ) - setInpVal( '' ) - } - - return ( -
    - ) => setInpVal( event.target.value ) }/> - -
    - ) -} - -export default AddToDo diff --git a/members/feligo887/task1/src/components/Header/index.tsx b/members/feligo887/task1/src/components/Header/index.tsx deleted file mode 100644 index b72826511..000000000 --- a/members/feligo887/task1/src/components/Header/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -const Header = () => { - return ( -

    - To Do List -

    - ) -} - -export default Header \ No newline at end of file diff --git a/members/feligo887/task1/src/components/ToDoList/index.tsx b/members/feligo887/task1/src/components/ToDoList/index.tsx deleted file mode 100644 index 893357cb8..000000000 --- a/members/feligo887/task1/src/components/ToDoList/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { Checkbox } from '@mui/material' -import { DeleteForever } from '@mui/icons-material' - -// store -import { useSnapshot } from 'valtio' -import store from '../../store' -import { removeToDoList, changeToDoList } from '../../store/modules/toDoList.ts' -// style -import style from './style.module.css' -// type -import type { ToDoList } from '../../store/modules/toDoList.ts' - -const ToDoItem = ( props: { item: ToDoList['list'][0], index: number } ) => { - const { item, index } = props - return ( -
  • - changeToDoList( index ) }/> - { item.text } - removeToDoList( index ) }/> -
  • - ) -} - -const ToDoList = () => { - const snapshot = useSnapshot( store ) - const { toDoList } = snapshot - return ( -
      - { - toDoList.list.map( ( item, index ) => { - return ( - - ) - } ) - } -
    - ) -} - -export default ToDoList diff --git a/members/feligo887/task1/src/components/ToDoList/style.module.css b/members/feligo887/task1/src/components/ToDoList/style.module.css deleted file mode 100644 index ce841bffb..000000000 --- a/members/feligo887/task1/src/components/ToDoList/style.module.css +++ /dev/null @@ -1,23 +0,0 @@ -.to-do-item { - display: flex; - align-items: center; - justify-content: space-between; - margin-top: 8px; - padding-right: 8px; - position: relative; -} -.to-do-item::after { - content: ''; - display: block; - width: 0; - height: 1px; - background-color: #666; - position: absolute; - top: 50%; - left: 0; - transform: translateY(-50%); - transition: all 0.3s; -} -.to-do-item.check::after { - width: 100%; -} diff --git a/members/feligo887/task1/src/index.css b/members/feligo887/task1/src/index.css deleted file mode 100644 index 6119ad9a8..000000000 --- a/members/feligo887/task1/src/index.css +++ /dev/null @@ -1,68 +0,0 @@ -: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/feligo887/task1/src/main.tsx b/members/feligo887/task1/src/main.tsx deleted file mode 100644 index 79346cf8b..000000000 --- a/members/feligo887/task1/src/main.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import App from './App.tsx' -import './style/reset.css' - -createRoot(document.getElementById('root')!).render( - - - , -) diff --git a/members/feligo887/task1/src/store/index.ts b/members/feligo887/task1/src/store/index.ts deleted file mode 100644 index 6a4d5efe5..000000000 --- a/members/feligo887/task1/src/store/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { proxy } from 'valtio' -import { toDoList } from './modules/toDoList.ts' - -const store = proxy({ - toDoList -}) - -export default store diff --git a/members/feligo887/task1/src/store/modules/index.ts b/members/feligo887/task1/src/store/modules/index.ts deleted file mode 100644 index 1c9ec27f6..000000000 --- a/members/feligo887/task1/src/store/modules/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { toDoList as default } from './toDoList' diff --git a/members/feligo887/task1/src/store/modules/toDoList.ts b/members/feligo887/task1/src/store/modules/toDoList.ts deleted file mode 100644 index e50299091..000000000 --- a/members/feligo887/task1/src/store/modules/toDoList.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { proxy, subscribe } from 'valtio' - -export interface ToDoList { - list: Array<{ isChecked: boolean, text: string }> -} - -const loadState = () => { - const toDoList = localStorage.getItem( 'toDoList' ) - return toDoList ? JSON.parse( toDoList ) : { list: [] } -} - -// store -export const toDoList = proxy( loadState() ) - -// 增加数据 -export const addToDoList = ( text: string ) => { - toDoList.list.push( { - isChecked: false, - text, - } ) -} -// 修改数据选中状态数据 -export const changeToDoList = ( index: number ) => { - const record = toDoList.list[ index ] - record.isChecked = !record.isChecked - toDoList.list[ index ] = record -} -// 删除数据 -export const removeToDoList = ( index: number ) => { - toDoList.list.splice( index, 1 ) -} - -subscribe( toDoList, () => { - localStorage.setItem( 'toDoList', JSON.stringify( toDoList ) ) -} ) diff --git a/members/feligo887/task1/src/style/reset.css b/members/feligo887/task1/src/style/reset.css deleted file mode 100644 index 59a52051c..000000000 --- a/members/feligo887/task1/src/style/reset.css +++ /dev/null @@ -1,48 +0,0 @@ -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ - -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} -body { - line-height: 1; -} -ol, ul { - list-style: none; -} -blockquote, q { - quotes: none; -} -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} -table { - border-collapse: collapse; - border-spacing: 0; -} diff --git a/members/feligo887/task1/src/vite-env.d.ts b/members/feligo887/task1/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a..000000000 --- a/members/feligo887/task1/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/members/feligo887/task1/tsconfig.app.json b/members/feligo887/task1/tsconfig.app.json deleted file mode 100644 index f0a235055..000000000 --- a/members/feligo887/task1/tsconfig.app.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "module": "ESNext", - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - "jsx": "react-jsx", - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true - }, - "include": ["src"] -} diff --git a/members/feligo887/task1/tsconfig.json b/members/feligo887/task1/tsconfig.json deleted file mode 100644 index 1ffef600d..000000000 --- a/members/feligo887/task1/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "files": [], - "references": [ - { "path": "./tsconfig.app.json" }, - { "path": "./tsconfig.node.json" } - ] -} diff --git a/members/feligo887/task1/tsconfig.node.json b/members/feligo887/task1/tsconfig.node.json deleted file mode 100644 index 0d3d71446..000000000 --- a/members/feligo887/task1/tsconfig.node.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "lib": ["ES2023"], - "module": "ESNext", - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "isolatedModules": true, - "moduleDetection": "force", - "noEmit": true, - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true - }, - "include": ["vite.config.ts"] -} diff --git a/members/feligo887/task1/vite.config.ts b/members/feligo887/task1/vite.config.ts deleted file mode 100644 index 8394b47c2..000000000 --- a/members/feligo887/task1/vite.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [react()], - server: { - port: 1753 - } -}) diff --git a/package.json b/package.json index c050b0456..8b3d00976 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,14 @@ { "name": "@openbuild/web3-frontend-bootcamp", "private": true, - "devDependencies": {}, + "devDependencies": { + "@knosys/sdk": "^0.0.3", + "@ntks/toolbox": "^0.0.6", + "dayjs": "^1.11.12", + "dotenv": "^16.4.5", + "ksio": "^0.0.3", + "octokit": "^4.0.2" + }, "scripts": { "pmc": "node .knosys/scripts pmc", "site": "node .knosys/scripts site",