feat: pressing enter automatically navigates to the system page

This commit is contained in:
Spectralitree 2021-12-12 15:31:15 +01:00
parent 327d2b8aa5
commit f5f15a5335

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { Container, Row, Col, Card, CardHeader, CardTitle, CardBody, Input, Button } from 'sveltestrap';
import { Link } from 'svelte-navigator';
import { Link, navigate } from 'svelte-navigator';
import FaRocket from 'svelte-icons/fa/FaRocket.svelte';
let sysInput: string = "";
@ -21,7 +21,7 @@
Submit a <b>system ID</b> to view that system's profile.
<Row>
<Col xs={12} lg={9} class="my-2">
<Input bind:value={sysInput} />
<Input on:keyup={(event) => {if (event.key === "Enter" && sysInput !== "") navigate(`/public/s/${sysInput.toLowerCase().trim()}`)}} bind:value={sysInput} />
</Col>
<Col xs={12} lg={3} class="my-2 d-flex">
{#if sysInput !== ""}