PluralKit/src/lib/Navigation.svelte

51 lines
2.1 KiB
Svelte
Raw Normal View History

2021-12-09 11:53:54 +00:00
<script lang="ts">
import {Navbar, NavbarBrand, Nav, NavItem, NavLink, Collapse, NavbarToggler, Dropdown, DropdownItem, DropdownMenu, DropdownToggle} from 'sveltestrap';
2021-12-11 11:01:36 +00:00
import { loggedIn } from '../stores';
import { Link } from 'svelte-navigator';
2021-12-11 11:01:36 +00:00
export let style: string;
2021-12-09 11:53:54 +00:00
let isOpen = false;
const toggle = () => (isOpen = !isOpen);
2021-12-11 11:01:36 +00:00
let loggedIn_value: boolean;
loggedIn.subscribe(value => {
loggedIn_value = value;
});
</script>
<div style="background-color: #292929">
<Navbar color="light" light expand="lg" class="mb-4">
<NavbarBrand>pk-webs</NavbarBrand>
<NavbarToggler on:click={toggle}></NavbarToggler>
<Collapse {isOpen} navbar expand="lg">
<Nav class="ms-auto" navbar>
<Dropdown nav inNavbar>
<DropdownToggle color="transparent">Styles</DropdownToggle>
<DropdownMenu end>
<DropdownItem on:click={() => style = "light"}>Light</DropdownItem>
<DropdownItem on:click={() => style = "dark"}>Dark</DropdownItem>
</DropdownMenu>
</Dropdown>
{#if loggedIn_value || localStorage.getItem("pk-token")}
<Dropdown nav inNavbar>
<DropdownToggle color="transparent">Dash</DropdownToggle>
<DropdownMenu end>
<Link to="/dash" state={{tab: "system"}}><DropdownItem>System</DropdownItem></Link>
<Link to="/dash" state={{tab: "members"}}><DropdownItem>Members</DropdownItem></Link>
</DropdownMenu>
</Dropdown>
{/if}
<NavItem>
<NavLink href="/settings">Settings</NavLink>
</NavItem>
<NavItem>
<NavLink href="/templates">Templates</NavLink>
</NavItem>
<NavItem>
<NavLink href="/public">Public</NavLink>
</NavItem>
</Nav>
</Collapse>
</Navbar>
</div>