You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <script lang="ts">
  2. import { link } from "svelte-routing";
  3. import selectionStore from "../stores/selection";
  4. $: selected = {
  5. home: $selectionStore.path === "/",
  6. goals: $selectionStore.path.startsWith("/goals"),
  7. questlog: $selectionStore.path.startsWith("/questlog"),
  8. projects: $selectionStore.path.startsWith("/projects"),
  9. items: $selectionStore.path.startsWith("/items"),
  10. logs: $selectionStore.path.startsWith("/logs"),
  11. }
  12. </script>
  13. <nav>
  14. <a class:selected={selected.home} use:link href="/">Stufflog</a>
  15. <a class:selected={selected.goals} use:link href="/goals">Goals</a>
  16. <a class="desktop" class:selected={selected.questlog} use:link href="/questlog">Projects</a>
  17. <a class="mobile" class:selected={selected.projects} use:link href="/projects">Projects</a>
  18. <a class:selected={selected.items} use:link href="/items">Items</a>
  19. <a class:selected={selected.logs} use:link href="/logs">Logs</a>
  20. </nav>
  21. <style>
  22. nav {
  23. margin: 0;
  24. text-align: center;
  25. }
  26. a {
  27. display: inline-block;
  28. padding: 0.25em;
  29. color: #555;
  30. font-size: 1em;
  31. }
  32. a.selected {
  33. color: #AAA;
  34. }
  35. a.mobile {
  36. display: none;
  37. }
  38. @media screen and (max-width: 600px) {
  39. a.mobile {
  40. display: inline-block;
  41. }
  42. a.desktop {
  43. display: none;
  44. }
  45. }
  46. </style>