2024-06-15 22:53:32 +02:00
|
|
|
import React, {useState} from "react";
|
2024-06-08 23:52:26 +02:00
|
|
|
import "../index";
|
|
|
|
import {Checkbox} from "../src/Components/Forms/Checkbox";
|
|
|
|
import { Radio } from "../src/Components/Forms/Radio";
|
2024-07-07 18:37:34 +02:00
|
|
|
import {AirTrafficControl, Basket, FloppyDisk, House, TrashSimple, XCircle} from "@phosphor-icons/react";
|
2024-06-09 09:22:32 +02:00
|
|
|
import {Card} from "../src/Components/Card";
|
|
|
|
import {PasswordInput} from "../src/Components/Forms/PasswordInput";
|
|
|
|
import {RequiredField} from "../src/Components/Forms/RequiredField";
|
2024-06-15 22:53:32 +02:00
|
|
|
import {Float} from "../src/Components/Floating/Float";
|
|
|
|
import {Tooltip} from "../src/Components/Floating/Tooltip";
|
|
|
|
import {DatepickerInput} from "../src/Components/Forms/DatepickerInput";
|
|
|
|
import {TimepickerInput} from "../src/Components/Forms/TimepickerInput";
|
2024-07-06 14:13:09 +02:00
|
|
|
import {Select} from "../src/Components/Select/Select";
|
2024-07-06 16:52:26 +02:00
|
|
|
import {SpinningLoader} from "../src/Components/Loaders/SpinningLoader";
|
|
|
|
import {ListLoader} from "../src/Components/Loaders/ListLoader";
|
|
|
|
import {GenericLoader} from "../src/Components/Loaders/GenericLoader";
|
2024-07-07 13:15:28 +02:00
|
|
|
import {MainMenu} from "../src/Components/Menus/MainMenu";
|
|
|
|
import {SubmenuFloat} from "../src/Components/Menus/SubmenuFloat";
|
|
|
|
import {Submenu} from "../src/Components/Menus/Submenu";
|
|
|
|
import {SubmenuItem, SubmenuItemSubmenu} from "../src/Components/Menus/SubmenuItem";
|
2024-07-07 18:37:34 +02:00
|
|
|
import {MainMenuItemSubmenu, MainMenuLink} from "../src/Components/Menus/MainMenuItem";
|
|
|
|
import {AppItem, AppLink, AppsMenu} from "../src/Components/Menus/AppsMenu";
|
|
|
|
import {Application} from "../src/Application/Application";
|
|
|
|
import {Outlet} from "react-router-dom";
|
2024-07-07 19:47:29 +02:00
|
|
|
import {ToggleSwitch} from "../src/Components/Forms/ToggleSwitch";
|
2024-06-08 23:52:26 +02:00
|
|
|
|
|
|
|
export function DemoApp()
|
|
|
|
{
|
2024-06-15 22:53:32 +02:00
|
|
|
const [datetime, setDatetime] = useState(null);
|
|
|
|
|
2024-07-06 14:13:09 +02:00
|
|
|
const [selected, setSelected] = useState(null);
|
|
|
|
|
2024-06-08 23:52:26 +02:00
|
|
|
return (
|
2024-07-07 18:37:34 +02:00
|
|
|
<Application>
|
2024-07-07 13:15:28 +02:00
|
|
|
<MainMenu>
|
2024-07-07 18:37:34 +02:00
|
|
|
<MainMenuLink to={"/"}><House /> Home</MainMenuLink>
|
|
|
|
<MainMenuLink to={"/test"}><AirTrafficControl /> Test</MainMenuLink>
|
2024-07-07 13:15:28 +02:00
|
|
|
<MainMenuItemSubmenu submenu={
|
|
|
|
<Submenu>
|
|
|
|
<SubmenuItem>Test 1</SubmenuItem>
|
|
|
|
<SubmenuItem>Test 2</SubmenuItem>
|
|
|
|
<SubmenuItemSubmenu submenu={
|
|
|
|
<Submenu>
|
|
|
|
<SubmenuItem>Test A</SubmenuItem>
|
|
|
|
<SubmenuItem>Test B</SubmenuItem>
|
|
|
|
<SubmenuItemSubmenu submenu={
|
|
|
|
<Submenu>
|
|
|
|
<SubmenuItem href={"#first-last-choice"}>First last choice</SubmenuItem>
|
|
|
|
<SubmenuItem>Another last choice</SubmenuItem>
|
|
|
|
</Submenu>
|
2024-07-07 18:37:34 +02:00
|
|
|
}><Basket /> Submenu in submenu</SubmenuItemSubmenu>
|
2024-07-07 13:15:28 +02:00
|
|
|
</Submenu>
|
2024-07-07 18:37:34 +02:00
|
|
|
}><Basket /> Submenu</SubmenuItemSubmenu>
|
2024-07-07 13:15:28 +02:00
|
|
|
</Submenu>
|
|
|
|
}>
|
2024-07-07 18:37:34 +02:00
|
|
|
<Basket /> Submenu
|
2024-07-07 13:15:28 +02:00
|
|
|
</MainMenuItemSubmenu>
|
|
|
|
</MainMenu>
|
|
|
|
|
2024-06-08 23:52:26 +02:00
|
|
|
<h1>KernelUI</h1>
|
|
|
|
|
2024-06-09 09:22:32 +02:00
|
|
|
<h2>TODO</h2>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>App steps</li>
|
|
|
|
<li>Pagination</li>
|
|
|
|
<li>Global states</li>
|
|
|
|
<li>Async</li>
|
|
|
|
<li>Subapps</li>
|
|
|
|
<li>Modals</li>
|
|
|
|
</ul>
|
|
|
|
|
2024-06-08 23:52:26 +02:00
|
|
|
<h2>Headings</h2>
|
|
|
|
|
|
|
|
<h1>Demo app</h1>
|
|
|
|
|
|
|
|
<h2>Second title</h2>
|
|
|
|
|
|
|
|
<h3>Third title</h3>
|
|
|
|
|
|
|
|
<h4>Fourth title</h4>
|
|
|
|
|
|
|
|
<h5>Fifth title</h5>
|
|
|
|
|
|
|
|
<h6>Sixth title</h6>
|
|
|
|
|
|
|
|
<h2>Buttons</h2>
|
|
|
|
|
|
|
|
<button type={"button"}>A cool button</button>
|
|
|
|
<a className={"button"} href={"#"}>A link button</a>
|
|
|
|
<button type={"button"} className={"flat"}>A flat button</button>
|
2024-07-07 18:37:34 +02:00
|
|
|
<button type={"button"} className={"validation"}><FloppyDisk /> A validation button</button>
|
|
|
|
<button type={"button"} className={"cancel"}><XCircle /> A cancellation button</button>
|
|
|
|
<button type={"button"} className={"delete"}><TrashSimple /> A deletion button</button>
|
2024-06-08 23:52:26 +02:00
|
|
|
|
|
|
|
<h2>Forms</h2>
|
|
|
|
|
|
|
|
<form>
|
|
|
|
<label>
|
2024-07-06 16:52:26 +02:00
|
|
|
Text label <RequiredField/>
|
|
|
|
<input type={"text"} placeholder={"Normal demo text"} required={true}/>
|
2024-06-08 23:52:26 +02:00
|
|
|
</label>
|
|
|
|
|
|
|
|
<label>
|
2024-07-06 16:52:26 +02:00
|
|
|
Textarea label <RequiredField/>
|
2024-06-09 09:22:32 +02:00
|
|
|
<textarea placeholder={"A normal textarea."} required={true}></textarea>
|
2024-06-08 23:52:26 +02:00
|
|
|
</label>
|
|
|
|
|
2024-06-09 09:22:32 +02:00
|
|
|
<PasswordInput>
|
|
|
|
Test password
|
|
|
|
</PasswordInput>
|
|
|
|
|
2024-06-15 22:53:32 +02:00
|
|
|
<DatepickerInput value={datetime} onChange={setDatetime}>
|
|
|
|
Date test
|
|
|
|
</DatepickerInput>
|
|
|
|
|
|
|
|
<TimepickerInput value={datetime} onChange={setDatetime}>
|
|
|
|
Time test
|
|
|
|
</TimepickerInput>
|
|
|
|
|
|
|
|
<p>Currently selected datetime: <strong>{datetime ? datetime.toISOString() : "none"}</strong></p>
|
|
|
|
|
2024-06-08 23:52:26 +02:00
|
|
|
<Checkbox>Checkbox demo</Checkbox>
|
2024-07-07 19:47:29 +02:00
|
|
|
<ToggleSwitch>Toggle switch demo</ToggleSwitch>
|
2024-06-08 23:52:26 +02:00
|
|
|
<Radio name={"radio-test"}>Radio box test</Radio>
|
|
|
|
<Radio name={"radio-test"}>Radio box test</Radio>
|
2024-07-06 14:13:09 +02:00
|
|
|
|
|
|
|
<Select options={{
|
|
|
|
"a": "AAAAAA",
|
|
|
|
"b": "BBBBBB",
|
|
|
|
"c": "CCCCCC",
|
|
|
|
"d": "DDDDDD",
|
|
|
|
"e": "EEEEEE",
|
|
|
|
"f": "FFFFFF",
|
|
|
|
}} value={selected} onChange={setSelected} selectibleMaxCount={3} placeholder={"Simple test"}>
|
|
|
|
Simple select test
|
|
|
|
</Select>
|
2024-06-08 23:52:26 +02:00
|
|
|
</form>
|
|
|
|
|
|
|
|
<h2>HTML</h2>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<a href={"#"}>Link test</a>
|
|
|
|
</div>
|
|
|
|
<p>
|
2024-07-06 16:52:26 +02:00
|
|
|
<strong>Lorem ipsum</strong> dolor <code>sit amet</code>, <em>consectetur</em> adipiscing elit <a
|
|
|
|
href={"https://aleph.land"} target={"_blank"}>aleph</a>. Donec accumsan
|
2024-06-09 09:22:32 +02:00
|
|
|
pulvinar felis, vitae eleifend augue lacinia tempus. Integer nec iaculis ante. Duis a quam urna. Nullam
|
|
|
|
tincidunt rutrum felis, a efficitur enim facilisis sit amet. Quisque dictum semper sagittis. Maecenas in orci
|
|
|
|
hendrerit, tempor nunc non, tempus mi. Praesent blandit varius rutrum. Nullam quis mauris eros. Vestibulum
|
|
|
|
commodo libero sed pellentesque pharetra. Donec eget fringilla ante. Aliquam id leo massa. Duis dictum nunc ut
|
|
|
|
dolor iaculis malesuada. Nulla elementum justo a sem eleifend finibus. Phasellus bibendum elit nibh, at tempor
|
|
|
|
odio efficitur id.
|
2024-06-08 23:52:26 +02:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<h2>Steps</h2>
|
|
|
|
|
|
|
|
<div className={"steps"}>
|
|
|
|
<h3 className={"step"}>Step one</h3>
|
|
|
|
<h3 className={"step"}>Step two</h3>
|
|
|
|
<h3 className={"step"}>Step three</h3>
|
|
|
|
</div>
|
2024-06-09 09:22:32 +02:00
|
|
|
|
|
|
|
<h2>Lists</h2>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>One</li>
|
|
|
|
<li>Two</li>
|
|
|
|
<li>Three</li>
|
|
|
|
<li>Four</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<ol>
|
|
|
|
<li>One</li>
|
|
|
|
<li>Two</li>
|
|
|
|
<li>Three</li>
|
|
|
|
<li>Four</li>
|
|
|
|
</ol>
|
|
|
|
|
|
|
|
<h2>Tables</h2>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Column 1</th>
|
|
|
|
<th>Column 2</th>
|
|
|
|
<th colSpan={2}>Column 3</th>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<th>A</th>
|
|
|
|
<th>B</th>
|
|
|
|
<th>C</th>
|
|
|
|
<th>D</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>Lorem</td>
|
|
|
|
<td>Ipsum</td>
|
|
|
|
<td>Dolor</td>
|
|
|
|
<td>Amet</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Foo</td>
|
|
|
|
<td>Bar</td>
|
|
|
|
<td>Baz</td>
|
|
|
|
<td>John</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td>Alice</td>
|
|
|
|
<td>Bob</td>
|
|
|
|
<td></td>
|
|
|
|
<td>Jack</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
<h2>Cards</h2>
|
|
|
|
|
|
|
|
<Card>
|
|
|
|
<h3>Card title</h3>
|
|
|
|
|
2024-06-09 12:13:42 +02:00
|
|
|
<p>
|
|
|
|
Donec lobortis quam sapien, et efficitur dolor laoreet ut. Ut pretium, lacus at bibendum rutrum, nibh nibh
|
|
|
|
scelerisque nisi, nec semper dolor turpis sed tortor. Nulla massa sapien, accumsan id vestibulum et, elementum
|
|
|
|
eget metus. Morbi quis bibendum purus. Nunc at fermentum tortor. Quisque viverra diam in sem auctor blandit.
|
|
|
|
Vestibulum dignissim bibendum nunc, non tristique quam sollicitudin eu. Ut feugiat lectus tellus, tempus
|
|
|
|
viverra sapien aliquet vel. Morbi ac est mauris. Praesent facilisis ut tellus at cursus. Aenean placerat nulla
|
|
|
|
non mi vulputate hendrerit. Praesent fermentum dui eu gravida pharetra. Quisque rhoncus, magna non congue
|
|
|
|
egestas, leo lorem malesuada felis, eu imperdiet orci magna ultrices est.
|
|
|
|
</p>
|
2024-06-09 09:22:32 +02:00
|
|
|
|
|
|
|
<button type={"button"}>Button position ?</button>
|
|
|
|
<button type={"button"}>Button position ?</button>
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
<Card>
|
|
|
|
<p>Another small card</p>
|
|
|
|
</Card>
|
2024-06-09 12:13:42 +02:00
|
|
|
|
|
|
|
<h2>Popovers</h2>
|
|
|
|
|
2024-06-15 22:53:32 +02:00
|
|
|
<Float mode={"hover"} content={"Do you see me?"}>
|
2024-06-09 12:13:42 +02:00
|
|
|
<button type={"button"}>Hover me!</button>
|
2024-06-15 22:53:32 +02:00
|
|
|
</Float>
|
2024-06-09 12:13:42 +02:00
|
|
|
|
2024-06-15 22:53:32 +02:00
|
|
|
<Float mode={"focus"} content={<>I am <strong>focused</strong></>}>
|
2024-06-09 12:13:42 +02:00
|
|
|
<button>Focus me!</button>
|
2024-06-15 22:53:32 +02:00
|
|
|
</Float>
|
2024-06-09 12:13:42 +02:00
|
|
|
|
2024-06-15 22:53:32 +02:00
|
|
|
<Float mode={"click"} content={(
|
2024-06-09 12:13:42 +02:00
|
|
|
<div>
|
|
|
|
You can add complex (clickable) content in me.
|
|
|
|
<button type={"button"}>OK</button>
|
|
|
|
</div>
|
|
|
|
)}>
|
|
|
|
<button>Click me!</button>
|
2024-06-15 22:53:32 +02:00
|
|
|
</Float>
|
2024-06-09 12:13:42 +02:00
|
|
|
|
2024-07-06 16:52:26 +02:00
|
|
|
<Float mode={"always"} content={"I am always shown."} floatingOptions={{placement: "top"}}>
|
2024-06-09 12:13:42 +02:00
|
|
|
<button>Why always me?</button>
|
2024-06-15 22:53:32 +02:00
|
|
|
</Float>
|
2024-06-09 12:13:42 +02:00
|
|
|
|
|
|
|
<div>
|
2024-06-15 22:53:32 +02:00
|
|
|
<Float mode={"managed"} content={(show, hide) => (<button onClick={hide}>I can hide the popover!</button>)}>
|
2024-06-09 12:13:42 +02:00
|
|
|
{(show, hide) => (
|
|
|
|
<button type={"button"} onClick={show}>Customized behavior</button>
|
|
|
|
)}
|
2024-06-15 22:53:32 +02:00
|
|
|
</Float>
|
2024-06-09 12:13:42 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<h2>Tooltips</h2>
|
|
|
|
|
|
|
|
<Card>
|
|
|
|
This is a very simple <Tooltip content={"I am a beautiful simple tooltip."}><a>tooltip</a></Tooltip>.
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
<h2>Loaders</h2>
|
2024-07-06 16:52:26 +02:00
|
|
|
|
|
|
|
<h3>Simple loaders</h3>
|
|
|
|
|
|
|
|
<Card>
|
|
|
|
<SpinningLoader/>
|
|
|
|
|
|
|
|
<ListLoader/>
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
<h3>Generic loader</h3>
|
|
|
|
<GenericLoader>
|
|
|
|
<Card>
|
|
|
|
Sample content.
|
|
|
|
</Card>
|
|
|
|
</GenericLoader>
|
2024-07-07 13:15:28 +02:00
|
|
|
|
|
|
|
<h2>Menus</h2>
|
|
|
|
|
|
|
|
<SubmenuFloat submenu={
|
|
|
|
<Submenu>
|
|
|
|
<SubmenuItem>Test 1</SubmenuItem>
|
|
|
|
<SubmenuItem>Test 2</SubmenuItem>
|
|
|
|
<SubmenuItemSubmenu submenu={
|
|
|
|
<Submenu>
|
|
|
|
<SubmenuItem>Test A</SubmenuItem>
|
2024-07-07 18:37:34 +02:00
|
|
|
<SubmenuItem><AirTrafficControl /> Test B</SubmenuItem>
|
2024-07-07 13:15:28 +02:00
|
|
|
</Submenu>
|
|
|
|
}>
|
2024-07-07 18:37:34 +02:00
|
|
|
<Basket /> Submenu
|
2024-07-07 13:15:28 +02:00
|
|
|
</SubmenuItemSubmenu>
|
|
|
|
</Submenu>
|
|
|
|
} floatingOptions={{ placement: "right-start" }}>
|
|
|
|
<button>Submenu on a button</button>
|
|
|
|
</SubmenuFloat>
|
2024-07-07 18:37:34 +02:00
|
|
|
|
|
|
|
<h2>App selectors</h2>
|
|
|
|
|
|
|
|
<AppsMenu>
|
|
|
|
<AppLink to={"/"}>
|
|
|
|
<House />
|
|
|
|
Home
|
|
|
|
</AppLink>
|
|
|
|
<AppLink to={"/test"}>
|
|
|
|
<AirTrafficControl />
|
|
|
|
Test link
|
|
|
|
</AppLink>
|
|
|
|
<AppItem>
|
|
|
|
<Basket />
|
|
|
|
Test 3
|
|
|
|
</AppItem>
|
|
|
|
</AppsMenu>
|
|
|
|
|
|
|
|
<Outlet />
|
|
|
|
</Application>
|
2024-06-08 23:52:26 +02:00
|
|
|
);
|
|
|
|
}
|