mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-26 15:02:21 +03:00
@@ -13,6 +13,8 @@
|
||||
"autoprefixer": "^10.3.1",
|
||||
"postcss": "^8.3.6",
|
||||
"postcss-load-config": "^3.1.0",
|
||||
"prettier": "^2.3.2",
|
||||
"prettier-plugin-svelte": "^2.3.1",
|
||||
"rollup": "^2.3.4",
|
||||
"rollup-plugin-css-only": "^3.1.0",
|
||||
"rollup-plugin-livereload": "^2.0.0",
|
||||
@@ -21,8 +23,6 @@
|
||||
"svelte": "^3.0.0",
|
||||
"svelte-preprocess": "^4.7.4",
|
||||
"tailwindcss": "^2.2.7",
|
||||
"prettier": "^2.3.2",
|
||||
"prettier-plugin-svelte": "^2.3.1",
|
||||
"tinro": "^0.5.12"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
<script>
|
||||
//роутер =========================================
|
||||
//роутер ==========================================
|
||||
import { Route, router, active } from "tinro";
|
||||
router.mode.hash(); // enables hash navigation method
|
||||
//router.mode.memory(); // enables in-memory navigation method
|
||||
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>
|
||||
|
||||
<main>
|
||||
@@ -36,6 +41,9 @@
|
||||
<li>
|
||||
<a class="menu__item" href="/about">{"О проекте"}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="menu__item" href="/test">{"Test"}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
@@ -136,6 +144,17 @@
|
||||
</div>
|
||||
</Card>
|
||||
</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>
|
||||
</ul>
|
||||
</main>
|
||||
|
||||
20
src/Input.svelte
Normal file
20
src/Input.svelte
Normal 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>
|
||||
Reference in New Issue
Block a user