add first svelte component

This commit is contained in:
Dmitry Borisenko
2021-08-13 19:48:51 +08:00
parent 9759550858
commit ff51b6a867
2 changed files with 97 additions and 109 deletions

View File

@@ -3,6 +3,7 @@
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";
</script> </script>
<main> <main>
@@ -41,35 +42,15 @@
<ul class="menu__main"> <ul class="menu__main">
<div class="bg-cover bg-gray-50 pt-16"> <div class="bg-cover bg-gray-50 pt-16">
<Route path="/"> <Route path="/">
<!-- Card Container --> <Card title="Здесь будет dashboard" />
<div class="grid place-items-center mx-2 sm:my-auto">
<!-- Card -->
<div class="w-11/12 p-12 sm:w-8/12 md:w-6/12 lg:w-5/12 2xl:w-4/12 px-6 py-10 my-5 sm:px-10 sm:py-6 bg-white rounded-lg shadow-md lg:shadow-lg">
<!-- Card Title -->
<h1 class="text-center text-lg text-gray-500 font-bold pb-6">Здесь будет dashboard</h1>
</div>
</div>
</Route> </Route>
<Route path="/config"> <Route path="/config">
<!-- Card Container --> <Card title="Здесь будет конфигуратор" />
<div class="grid place-items-center mx-2 sm:my-auto">
<!-- Card -->
<div class="w-11/12 p-12 sm:w-8/12 md:w-6/12 lg:w-5/12 2xl:w-4/12 px-6 py-10 my-5 sm:px-10 sm:py-6 bg-white rounded-lg shadow-md lg:shadow-lg">
<!-- Card Title -->
<h1 class="text-center text-lg text-gray-500 font-bold pb-6">Здесь будет конфигуратор</h1>
</div>
</div>
</Route> </Route>
<Route path="/connection"> <Route path="/connection">
<!-- Card Container --> <Card title="Подключение к WiFi роутеру">
<div class="grid place-items-center mx-2 sm:my-auto">
<!-- Card -->
<div class="w-11/12 p-12 sm:w-8/12 md:w-6/12 lg:w-5/12 2xl:w-4/12 px-6 py-10 my-5 sm:px-10 sm:py-6 bg-white rounded-lg shadow-md lg:shadow-lg">
<!-- Card Title -->
<h1 class="text-center text-lg text-gray-500 font-bold pb-6">Подключение к WiFi роутеру</h1>
<div class="md:flex md:items-center mb-6"> <div class="md:flex md:items-center mb-6">
<div class="md:w-1/3"> <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"> Сеть </label> <label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name"> Сеть </label>
@@ -99,16 +80,9 @@
<button class="shadow bg-purple-500 hover:bg-purple-400 focus:shadow-outline focus:outline-none text-white font-bold py-2 px-4 rounded" type="button"> Сохранить </button> <button class="shadow bg-purple-500 hover:bg-purple-400 focus:shadow-outline focus:outline-none text-white font-bold py-2 px-4 rounded" type="button"> Сохранить </button>
</div> </div>
</div> </div>
</div> </Card>
</div>
<!-- Card Container -->
<div class="grid place-items-center mx-2 sm:my-auto">
<!-- Card -->
<div class="w-11/12 p-12 sm:w-8/12 md:w-6/12 lg:w-5/12 2xl:w-4/12 px-6 py-10 my-5 sm:px-10 sm:py-6 bg-white rounded-lg shadow-md lg:shadow-lg">
<!-- Card Title -->
<h1 class="text-center text-lg text-gray-500 font-bold pb-6">Подключение к MQTT серверу</h1>
<Card title="Подключение к MQTT серверу">
<div class="md:flex md:items-center mb-6"> <div class="md:flex md:items-center mb-6">
<div class="md:w-1/3"> <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"> Сервер </label> <label class="block text-gray-500 font-bold md:text-right mb-1 md:mb-0 pr-4" for="inline-full-name"> Сервер </label>
@@ -160,8 +134,7 @@
<button class="shadow bg-purple-500 hover:bg-purple-400 focus:shadow-outline focus:outline-none text-white font-bold py-2 px-4 rounded" type="button"> Сохранить </button> <button class="shadow bg-purple-500 hover:bg-purple-400 focus:shadow-outline focus:outline-none text-white font-bold py-2 px-4 rounded" type="button"> Сохранить </button>
</div> </div>
</div> </div>
</div> </Card>
</div>
</Route> </Route>
</div> </div>
</ul> </ul>

15
src/Card.svelte Normal file
View File

@@ -0,0 +1,15 @@
<script>
export let title;
</script>
<div class="container">
<!-- Card Container -->
<div class="grid place-items-center mx-2 sm:my-auto">
<!-- Card -->
<div class="w-11/12 p-12 sm:w-8/12 md:w-6/12 lg:w-5/12 2xl:w-4/12 px-6 py-10 my-5 sm:px-10 sm:py-6 bg-white rounded-lg shadow-md lg:shadow-lg">
<!-- Card Title -->
<h1 class="text-center text-lg text-gray-500 font-bold pb-6">{title}</h1>
<slot />
</div>
</div>
</div>