Merge pull request #1 from DmitryBorisenko33/main

test
This commit is contained in:
Dmitry Borisenko
2021-08-15 05:16:24 +08:00
committed by GitHub
3 changed files with 42 additions and 3 deletions

View File

@@ -13,6 +13,8 @@
"autoprefixer": "^10.3.1", "autoprefixer": "^10.3.1",
"postcss": "^8.3.6", "postcss": "^8.3.6",
"postcss-load-config": "^3.1.0", "postcss-load-config": "^3.1.0",
"prettier": "^2.3.2",
"prettier-plugin-svelte": "^2.3.1",
"rollup": "^2.3.4", "rollup": "^2.3.4",
"rollup-plugin-css-only": "^3.1.0", "rollup-plugin-css-only": "^3.1.0",
"rollup-plugin-livereload": "^2.0.0", "rollup-plugin-livereload": "^2.0.0",
@@ -21,8 +23,6 @@
"svelte": "^3.0.0", "svelte": "^3.0.0",
"svelte-preprocess": "^4.7.4", "svelte-preprocess": "^4.7.4",
"tailwindcss": "^2.2.7", "tailwindcss": "^2.2.7",
"prettier": "^2.3.2",
"prettier-plugin-svelte": "^2.3.1",
"tinro": "^0.5.12" "tinro": "^0.5.12"
}, },
"dependencies": { "dependencies": {

View File

@@ -1,9 +1,14 @@
<script> <script>
//роутер ========================================= //роутер ==========================================
import { Route, router, active } from "tinro"; import { Route, router, active } from "tinro";
router.mode.hash(); // enables hash navigation method router.mode.hash(); // enables hash navigation method
//router.mode.memory(); // enables in-memory navigation method //router.mode.memory(); // enables in-memory navigation method
import Card from "./Card.svelte"; import Card from "./Card.svelte";
import Input from "./Input.svelte";
let text1 = "";
let text2 = "";
const handleChange1 = value => (text1 = value);
const handleChange2 = value => (text2 = value);
</script> </script>
<main> <main>
@@ -36,6 +41,9 @@
<li> <li>
<a class="menu__item" href="/about">{"О проекте"}</a> <a class="menu__item" href="/about">{"О проекте"}</a>
</li> </li>
<li>
<a class="menu__item" href="/test">{"Test"}</a>
</li>
</ul> </ul>
</ul> </ul>
@@ -136,6 +144,17 @@
</div> </div>
</Card> </Card>
</Route> </Route>
<Route path="/test">
<Card title="Testing card1">
<Input onChange={handleChange1} title="Input text1" />
<h1>{text1}</h1>
</Card>
<Card title="Testing card2">
<Input onChange={handleChange2} title="Input text2" />
<h1>{text2}</h1>
</Card>
</Route>
</div> </div>
</ul> </ul>
</main> </main>

20
src/Input.svelte Normal file
View File

@@ -0,0 +1,20 @@
<script>
export let title;
export let onChange;
const handleBlur = e => {
if ('function' === typeof onChange) {
onChange(e.target.value);
}
};
</script>
<div class="container">
<div class="md:flex md:items-center mb-6">
<div class="md:w-1/3">
<label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name">{title}</label>
</div>
<div class="md:w-2/3">
<input on:input={handleBlur} class="bg-gray-200 appearance-none border-2 border-gray-200 rounded w-full py-2 px-4 text-gray-700 leading-tight focus:outline-none focus:bg-white focus:border-purple-500" id="inline-full-name" type="text" />
</div>
</div>
</div>