Spaces:
Running
Running
Mobile navs: bigger buttons and hide new? (#720)
Browse files
src/lib/components/MobileNav.svelte
CHANGED
|
@@ -3,10 +3,11 @@
|
|
| 3 |
import { createEventDispatcher } from "svelte";
|
| 4 |
import { browser } from "$app/environment";
|
| 5 |
import { base } from "$app/paths";
|
|
|
|
| 6 |
|
| 7 |
import CarbonClose from "~icons/carbon/close";
|
| 8 |
-
import CarbonAdd from "~icons/carbon/add";
|
| 9 |
import CarbonTextAlignJustify from "~icons/carbon/text-align-justify";
|
|
|
|
| 10 |
|
| 11 |
export let isOpen = false;
|
| 12 |
export let title: string | undefined;
|
|
@@ -30,18 +31,20 @@
|
|
| 30 |
</script>
|
| 31 |
|
| 32 |
<nav
|
| 33 |
-
class="flex h-12 items-center justify-between border-b bg-gray-50 px-
|
| 34 |
>
|
| 35 |
<button
|
| 36 |
type="button"
|
| 37 |
-
class="-ml-3 flex
|
| 38 |
on:click={() => dispatch("toggle", true)}
|
| 39 |
aria-label="Open menu"
|
| 40 |
bind:this={openEl}><CarbonTextAlignJustify /></button
|
| 41 |
>
|
| 42 |
<span class="truncate px-4">{title}</span>
|
| 43 |
-
<a
|
| 44 |
-
|
|
|
|
|
|
|
| 45 |
>
|
| 46 |
</nav>
|
| 47 |
<nav
|
|
@@ -52,7 +55,7 @@
|
|
| 52 |
<div class="flex h-12 items-center px-4">
|
| 53 |
<button
|
| 54 |
type="button"
|
| 55 |
-
class="-mr-3 ml-auto flex
|
| 56 |
on:click={() => dispatch("toggle", false)}
|
| 57 |
aria-label="Close menu"
|
| 58 |
bind:this={closeEl}><CarbonClose /></button
|
|
|
|
| 3 |
import { createEventDispatcher } from "svelte";
|
| 4 |
import { browser } from "$app/environment";
|
| 5 |
import { base } from "$app/paths";
|
| 6 |
+
import { page } from "$app/stores";
|
| 7 |
|
| 8 |
import CarbonClose from "~icons/carbon/close";
|
|
|
|
| 9 |
import CarbonTextAlignJustify from "~icons/carbon/text-align-justify";
|
| 10 |
+
import IconNew from "$lib/components/icons/IconNew.svelte";
|
| 11 |
|
| 12 |
export let isOpen = false;
|
| 13 |
export let title: string | undefined;
|
|
|
|
| 31 |
</script>
|
| 32 |
|
| 33 |
<nav
|
| 34 |
+
class="flex h-12 items-center justify-between border-b bg-gray-50 px-3 md:hidden dark:border-gray-800 dark:bg-gray-800/70"
|
| 35 |
>
|
| 36 |
<button
|
| 37 |
type="button"
|
| 38 |
+
class="-ml-3 flex size-12 shrink-0 items-center justify-center text-lg"
|
| 39 |
on:click={() => dispatch("toggle", true)}
|
| 40 |
aria-label="Open menu"
|
| 41 |
bind:this={openEl}><CarbonTextAlignJustify /></button
|
| 42 |
>
|
| 43 |
<span class="truncate px-4">{title}</span>
|
| 44 |
+
<a
|
| 45 |
+
class:invisible={!$page.params.id}
|
| 46 |
+
href="{base}/"
|
| 47 |
+
class="-mr-3 flex size-12 shrink-0 items-center justify-center text-lg"><IconNew /></a
|
| 48 |
>
|
| 49 |
</nav>
|
| 50 |
<nav
|
|
|
|
| 55 |
<div class="flex h-12 items-center px-4">
|
| 56 |
<button
|
| 57 |
type="button"
|
| 58 |
+
class="-mr-3 ml-auto flex size-12 items-center justify-center text-lg"
|
| 59 |
on:click={() => dispatch("toggle", false)}
|
| 60 |
aria-label="Close menu"
|
| 61 |
bind:this={closeEl}><CarbonClose /></button
|
src/lib/components/icons/IconNew.svelte
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<script lang="ts">
|
| 2 |
+
export let classNames = "";
|
| 3 |
+
</script>
|
| 4 |
+
|
| 5 |
+
<svg
|
| 6 |
+
xmlns="http://www.w3.org/2000/svg"
|
| 7 |
+
class={classNames}
|
| 8 |
+
width="1em"
|
| 9 |
+
height="1em"
|
| 10 |
+
fill="none"
|
| 11 |
+
viewBox="0 0 32 32"
|
| 12 |
+
><path
|
| 13 |
+
fill="currentColor"
|
| 14 |
+
fill-rule="evenodd"
|
| 15 |
+
d="M3.143 20.286h4.286v2.142H3.143A2.143 2.143 0 0 1 1 20.287V3.143A2.143 2.143 0 0 1 3.143 1h17.143a2.143 2.143 0 0 1 2.142 2.143v4.286h-2.142V3.143H3.143v17.143Zm9.643-12.857v3.214H16v2.143h-3.214V16h-2.143v-3.214H7.429v-2.143h3.214V7.429h2.143Zm14.185 2.639 3.533 3.532a1.7 1.7 0 0 1 0 2.4L15.5 31H9.57v-5.928l15-15.004a1.7 1.7 0 0 1 2.4 0Zm-15.257 18.79h2.897l10.116-10.116-2.899-2.897L11.714 25.96v2.897ZM23.346 14.33l2.897 2.897 2.429-2.43-2.897-2.896-2.43 2.429Z"
|
| 16 |
+
clip-rule="evenodd"
|
| 17 |
+
/></svg
|
| 18 |
+
>
|