fix: create collection modal not showing on mobile.

This commit is contained in:
Darshan committed 2024-12-14 11:39:56 +05:30
1 parent b0ed014eb4
commit 0b50b58120
3 files changed
+16 -7

No files matched your search

+9 -6
View File
@@ -7,21 +7,21 @@
import { activeHeaderAlert } from '$routes/(console)/store';
import { setContext } from 'svelte';
import { writable } from 'svelte/store';
import { showSubNavigation } from '$lib/stores/layout';
export let isOpen = false;
export let showSideNavigation = false;
let y: number;
page.subscribe(({ url }) => {
isOpen = url.searchParams.get('openNavbar') === 'true';
$showSubNavigation = url.searchParams.get('openNavbar') === 'true';
});
const toggleMenu = () => {
y = 0;
isOpen = !isOpen;
$showSubNavigation = !$showSubNavigation;
if (browser) {
if (isOpen) {
if ($showSubNavigation) {
document.body.classList.add('u-overflow-hidden');
} else {
document.body.classList.remove('u-overflow-hidden');
@@ -52,7 +52,7 @@
<main
class:grid-with-side={showSideNavigation}
class:is-open={isOpen}
class:is-open={$showSubNavigation}
class:u-hide={$wizard.show || $log.show || $wizard.cover}
class:is-fixed-layout={$activeHeaderAlert?.show}
style:--p-side-size={sideSize}>
@@ -65,7 +65,10 @@
class="icon-button is-not-desktop"
aria-label="Open Menu"
on:click={toggleMenu}>
<span class:icon-x={isOpen} class:icon-menu={!isOpen} aria-hidden="true" />
<span
class:icon-x={$showSubNavigation}
class:icon-menu={!$showSubNavigation}
aria-hidden="true" />
</button>
<slot name="header" />
</header>
+2
View File
@@ -25,3 +25,5 @@ export function updateLayout(args: updateLayoutArguments) {
header.set(args.header ?? null);
breadcrumb.set(args.breadcrumb ?? null);
}
export const showSubNavigation = writable(false);
@@ -3,6 +3,7 @@
import { page } from '$app/stores';
import { showCreate } from '../store';
import type { PageData } from './$types';
import { showSubNavigation } from '$lib/stores/layout';
$: data = $page.data as PageData;
$: project = $page.params.project;
@@ -24,7 +25,10 @@
<h5 class="eyebrow-heading-3 u-padding-block-12 is-not-mobile">Collections</h5>
<button
class="button is-text is-full-width u-main-start u-padding-inline-0"
on:click={() => ($showCreate = true)}>
on:click={() => {
$showCreate = true;
$showSubNavigation = false;
}}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">Create collection</span>
</button>