Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #286 from norskeld/consistent-event-handlers
Browse files Browse the repository at this point in the history
docs: use consistent and non-ambiguous event handler names
  • Loading branch information
edemaine authored Feb 6, 2024
2 parents c6277aa + 652060e commit c6c83cb
Show file tree
Hide file tree
Showing 67 changed files with 67 additions and 67 deletions.
2 changes: 1 addition & 1 deletion langs/de/guides/rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default function Form() {
return (
<div>
<BasicComponent value={value()} />
<input type="text" oninput={(e) => setValue(e.currentTarget.value)} />
<input type="text" onInput={(e) => setValue(e.currentTarget.value)} />
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion langs/de/tutorials/stores_createstore/lesson.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"name": "main",
"content": "import { render } from \"solid-js/web\";\nimport { For, createSignal } from \"solid-js\";\nimport { createStore } from \"solid-js/store\";\n\nconst App = () => {\n let input;\n let todoId = 0;\n const [todos, setTodos] = createSignal([])\n const addTodo = (text) => {\n setTodos([...todos(), { id: ++todoId, text, completed: false }]);\n }\n const toggleTodo = (id) => {\n setTodos(todos().map((todo) => (\n todo.id !== id ? todo : { ...todo, completed: !todo.completed }\n )));\n }\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={todos()}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onchange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\"}}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
"content": "import { render } from \"solid-js/web\";\nimport { For, createSignal } from \"solid-js\";\nimport { createStore } from \"solid-js/store\";\n\nconst App = () => {\n let input;\n let todoId = 0;\n const [todos, setTodos] = createSignal([])\n const addTodo = (text) => {\n setTodos([...todos(), { id: ++todoId, text, completed: false }]);\n }\n const toggleTodo = (id) => {\n setTodos(todos().map((todo) => (\n todo.id !== id ? todo : { ...todo, completed: !todo.completed }\n )));\n }\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={todos()}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onChange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\"}}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
}
]
}
2 changes: 1 addition & 1 deletion langs/de/tutorials/stores_createstore/solved.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"name": "main",
"content": "import { render } from \"solid-js/web\";\nimport { For } from \"solid-js\";\nimport { createStore } from \"solid-js/store\";\n\nconst App = () => {\n let input;\n let todoId = 0;\n const [store, setStore] = createStore({ todos: [] })\n const addTodo = (text) => {\n setStore(\"todos\", todos => [...todos, { id: ++todoId, text, completed: false }]);\n }\n const toggleTodo = (id) => {\n setStore(\"todos\", todo => todo.id === id, \"completed\", completed => !completed);\n }\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onchange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\" }}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
"content": "import { render } from \"solid-js/web\";\nimport { For } from \"solid-js\";\nimport { createStore } from \"solid-js/store\";\n\nconst App = () => {\n let input;\n let todoId = 0;\n const [store, setStore] = createStore({ todos: [] })\n const addTodo = (text) => {\n setStore(\"todos\", todos => [...todos, { id: ++todoId, text, completed: false }]);\n }\n const toggleTodo = (id) => {\n setStore(\"todos\", todo => todo.id === id, \"completed\", completed => !completed);\n }\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onChange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\" }}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
}
]
}
2 changes: 1 addition & 1 deletion langs/de/tutorials/stores_immutable/lesson.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"name": "main",
"content": "// @ts-nocheck\nimport { render } from \"solid-js/web\";\nimport { For } from \"solid-js\";\n\nimport useRedux from \"./useRedux\";\nimport reduxStore from \"./store\";\nimport actions from \"./actions\";\n\nconst App = () => {\n const [store, { addTodo, toggleTodo }] = useRedux(\n reduxStore,\n actions\n );\n let input;\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(\"Create\", text)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onchange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\"}}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
"content": "// @ts-nocheck\nimport { render } from \"solid-js/web\";\nimport { For } from \"solid-js\";\n\nimport useRedux from \"./useRedux\";\nimport reduxStore from \"./store\";\nimport actions from \"./actions\";\n\nconst App = () => {\n const [store, { addTodo, toggleTodo }] = useRedux(\n reduxStore,\n actions\n );\n let input;\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(\"Create\", text)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onChange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\"}}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
},
{
"name": "useRedux",
Expand Down
2 changes: 1 addition & 1 deletion langs/de/tutorials/stores_immutable/solved.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"name": "main",
"content": "// @ts-nocheck\nimport { render } from \"solid-js/web\";\nimport { For } from \"solid-js\";\n\nimport useRedux from \"./useRedux\";\nimport reduxStore from \"./store\";\nimport actions from \"./actions\";\n\nconst App = () => {\n const [store, { addTodo, toggleTodo }] = useRedux(\n reduxStore,\n actions\n );\n let input;\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(\"Create\", text)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onchange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\"}}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
"content": "// @ts-nocheck\nimport { render } from \"solid-js/web\";\nimport { For } from \"solid-js\";\n\nimport useRedux from \"./useRedux\";\nimport reduxStore from \"./store\";\nimport actions from \"./actions\";\n\nconst App = () => {\n const [store, { addTodo, toggleTodo }] = useRedux(\n reduxStore,\n actions\n );\n let input;\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(\"Create\", text)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onChange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\"}}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
},
{
"name": "useRedux",
Expand Down
2 changes: 1 addition & 1 deletion langs/de/tutorials/stores_mutation/lesson.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"name": "main",
"content": "import { render, For } from \"solid-js/web\";\nimport { createStore, produce } from \"solid-js/store\";\n\nconst App = () => {\n let input;\n let todoId = 0;\n const [store, setStore] = createStore({ todos: [] })\n const addTodo = (text) => {\n setStore(\"todos\", todos => [...todos, { id: ++todoId, text, completed: false }]);\n }\n const toggleTodo = (id) => {\n setStore(\"todos\", todo => todo.id === id, \"completed\", completed => !completed);\n }\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onchange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\" }}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
"content": "import { render, For } from \"solid-js/web\";\nimport { createStore, produce } from \"solid-js/store\";\n\nconst App = () => {\n let input;\n let todoId = 0;\n const [store, setStore] = createStore({ todos: [] })\n const addTodo = (text) => {\n setStore(\"todos\", todos => [...todos, { id: ++todoId, text, completed: false }]);\n }\n const toggleTodo = (id) => {\n setStore(\"todos\", todo => todo.id === id, \"completed\", completed => !completed);\n }\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onChange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\" }}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
}
]
}
2 changes: 1 addition & 1 deletion langs/de/tutorials/stores_mutation/solved.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"name": "main",
"content": "// @ts-nocheck\nimport { render, For } from \"solid-js/web\";\nimport { createStore, produce } from \"solid-js/store\";\n\nconst App = () => {\n let input;\n let todoId = 0;\n const [store, setStore] = createStore({ todos: [] })\n const addTodo = (text) => {\n setStore(\n 'todos',\n produce((todos) => {\n todos.push({ id: ++todoId, text, completed: false });\n }),\n );\n };\n const toggleTodo = (id) => {\n setStore(\n 'todos',\n todo => todo.id === id,\n produce((todo) => (todo.completed = !todo.completed)),\n );\n };\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onchange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\" }}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
"content": "// @ts-nocheck\nimport { render, For } from \"solid-js/web\";\nimport { createStore, produce } from \"solid-js/store\";\n\nconst App = () => {\n let input;\n let todoId = 0;\n const [store, setStore] = createStore({ todos: [] })\n const addTodo = (text) => {\n setStore(\n 'todos',\n produce((todos) => {\n todos.push({ id: ++todoId, text, completed: false });\n }),\n );\n };\n const toggleTodo = (id) => {\n setStore(\n 'todos',\n todo => todo.id === id,\n produce((todo) => (todo.completed = !todo.completed)),\n );\n };\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={store.todos}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onChange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\" }}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
}
]
}
2 changes: 1 addition & 1 deletion langs/de/tutorials/stores_nested_reactivity/lesson.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"files": [
{
"name": "main",
"content": "import { render } from \"solid-js/web\";\nimport { For, createSignal } from \"solid-js\";\n\nconst App = () => {\n const [todos, setTodos] = createSignal([])\n let input;\n let todoId = 0;\n\n const addTodo = (text) => {\n setTodos([...todos(), { id: ++todoId, text, completed: false }]);\n }\n const toggleTodo = (id) => {\n setTodos(todos().map((todo) => (\n todo.id !== id ? todo : { ...todo, completed: !todo.completed }\n )));\n }\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={todos()}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onchange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\"}}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
"content": "import { render } from \"solid-js/web\";\nimport { For, createSignal } from \"solid-js\";\n\nconst App = () => {\n const [todos, setTodos] = createSignal([])\n let input;\n let todoId = 0;\n\n const addTodo = (text) => {\n setTodos([...todos(), { id: ++todoId, text, completed: false }]);\n }\n const toggleTodo = (id) => {\n setTodos(todos().map((todo) => (\n todo.id !== id ? todo : { ...todo, completed: !todo.completed }\n )));\n }\n\n return (\n <>\n <div>\n <input ref={input} />\n <button\n onClick={(e) => {\n if (!input.value.trim()) return;\n addTodo(input.value);\n input.value = \"\";\n }}\n >\n Add Todo\n </button>\n </div>\n <For each={todos()}>\n {(todo) => {\n const { id, text } = todo;\n console.log(`Creating ${text}`)\n return <div>\n <input\n type=\"checkbox\"\n checked={todo.completed}\n onChange={[toggleTodo, id]}\n />\n <span\n style={{ \"text-decoration\": todo.completed ? \"line-through\" : \"none\"}}\n >{text}</span>\n </div>\n }}\n </For>\n </>\n );\n};\n\nrender(App, document.getElementById(\"app\"));\n"
}
]
}
Loading

0 comments on commit c6c83cb

Please sign in to comment.