Merge pull request #1273 from appwrite/fix-subnavigation-with-scrolling-table

fix: subnav with scrolling sticky table
This commit is contained in:
Torsten Dittmann authored and GitHub committed 2024-08-08 18:01:37 +02:00
commit 33bc8116d7
10 files changed
+49 -22

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
export let trimmed = true;
export let id: string = null;
export let style: string = undefined;
let classes: string = undefined;
let classes: string = '';
export { classes as class };
</script>
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts">
export let large = false;
export let stretch = false;
let classes: string = undefined;
let classes: string = '';
export { classes as class };
</script>
+1 -1
View File
@@ -7,7 +7,7 @@
export let width = 40;
export let height = 30;
export let quality = 100;
let classes: string = undefined;
let classes: string = '';
export { classes as class };
export function getFlag(country: string, width: number, height: number, quality: number) {
+1 -1
View File
@@ -21,7 +21,7 @@
export let ariaLabel: string = null;
export let noMargin = false;
export let event: string = null;
let classes: string = undefined;
let classes: string = '';
export { classes as class };
export let actions: MultiActionArray = [];
export let submissionLoader = false;
+26
View File
@@ -0,0 +1,26 @@
<script lang="ts">
export let title = '';
export let onlyDesktop = false;
export let width: number = null;
export let showOverflow = false;
let className = '';
export { className as class };
export let style = '';
export let right = false;
</script>
<button
{style}
style:--p-col-width={width?.toString() ?? ''}
class="table-col {className}"
class:u-overflow-visible={showOverflow}
class:is-only-desktop={onlyDesktop}
class:u-flex={right}
class:u-main-end={right}
data-title={title}
role="cell"
on:click
on:keypress
data-private>
<slot />
</button>
+4 -16
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { toggle } from '$lib/helpers/array';
import { isHTMLInputElement } from '$lib/helpers/types';
import { TableCell } from '.';
import { TableCellButton } from '.';
import { InputCheckbox } from '../forms';
export let id: string;
@@ -12,6 +12,7 @@
const handleClick = (e: Event) => {
// Prevent the link from being followed
e.preventDefault();
e.stopPropagation();
if (!isHTMLInputElement(el)) return;
selectedIds = toggle(selectedIds, id);
@@ -24,13 +25,7 @@
};
</script>
<TableCell class="u-position-relative">
<div
class="touch-area"
role="button"
tabindex="-1"
on:click={handleClick}
on:keypress={handleClick} />
<TableCellButton on:click={handleClick}>
<InputCheckbox
bind:element={el}
id="select-{id}"
@@ -38,11 +33,4 @@
checked={selectedIds.includes(id)}
{disabled}
on:click={handleClick} />
</TableCell>
<style lang="scss">
.touch-area {
position: absolute;
inset: 0;
}
</style>
</TableCellButton>
+1
View File
@@ -8,6 +8,7 @@ export { default as TableRow } from './row.svelte';
export { default as TableRowLink } from './rowLink.svelte';
export { default as TableRowButton } from './rowButton.svelte';
export { default as TableCell } from './cell.svelte';
export { default as TableCellButton } from './cellButton.svelte';
export { default as TableCellHead } from './cellHead.svelte';
export { default as TableCellHeadCheck } from './cellHeadCheck.svelte';
export { default as TableCellLink } from './cellLink.svelte';
+1 -1
View File
@@ -7,7 +7,7 @@
export let transparent = false;
export let noStyles = false;
export let dense = false;
let classes: string = undefined;
let classes: string = '';
export { classes as class };
let isOverflowing = false;
+5
View File
@@ -12,6 +12,8 @@
import { isCloud } from '$lib/system';
import Create from '$routes/console/feedbackWizard.svelte';
import { showSupportModal } from '$routes/console/wizard/support/store';
import { getContext } from 'svelte';
import type { Writable } from 'svelte/store';
export let isOpen = false;
@@ -29,6 +31,9 @@
narrow = hasSubNavigation;
}
$: getContext<Writable<boolean>>('isNarrow').set(narrow);
$: getContext<Writable<boolean>>('hasSubNavigation').set(hasSubNavigation);
function handleKeyDown(event: KeyboardEvent) {
// If Alt + S is pressed
if (hasSubNavigation && event.altKey && event.keyCode === 83) {
+8 -1
View File
@@ -5,6 +5,8 @@
import { log } from '$lib/stores/logs';
import { wizard } from '$lib/stores/wizard';
import { activeHeaderAlert } from '$routes/console/store';
import { setContext } from 'svelte';
import { writable } from 'svelte/store';
export let isOpen = false;
export let showSideNavigation = false;
@@ -40,6 +42,10 @@
wizard.hide();
}
});
const isNarrow = setContext('isNarrow', writable(false));
const hasSubNavigation = setContext('hasSubNavigation', writable(false));
$: sideSize = $hasSubNavigation ? ($isNarrow ? '17rem' : '25rem') : '12.5rem';
</script>
<svelte:window bind:scrollY={y} />
@@ -48,7 +54,8 @@
class:grid-with-side={showSideNavigation}
class:is-open={isOpen}
class:u-hide={$wizard.show || $log.show || $wizard.cover}
class:is-fixed-layout={$activeHeaderAlert?.show}>
class:is-fixed-layout={$activeHeaderAlert?.show}
style:--p-side-size={sideSize}>
{#if $activeHeaderAlert?.show}
<svelte:component this={$activeHeaderAlert.component} />
{/if}