Hides the sidebar when narrowed (#1661)

Signed-off-by: Alexander Platov <sas_lord@mail.ru>
This commit is contained in:
Alexander Platov 2022-05-05 20:17:04 +03:00 committed by GitHub
parent 19229fcd23
commit def00d4eb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 30 deletions

View File

@ -32,15 +32,9 @@
export let isSub: boolean = true
export let isAside: boolean = true
export let isCustomAttr: boolean = true
export let minimize: boolean = false
let docWidth: number = 0
$: minimize = docWidth < 1280 && docWidth >= 1024
$: needHeader = $$slots.header || minimize || isHeader
</script>
<svelte:window bind:innerWidth={docWidth} />
<Panel bind:isAside isHeader={needHeader} bind:panelWidth bind:innerWidth on:close>
<Panel bind:isAside isHeader={$$slots.header || isHeader} bind:panelWidth bind:innerWidth on:close>
<svelte:fragment slot="title">
<div class="popupPanel-title__content-container antiTitle">
{#if $$slots.navigator}
@ -72,23 +66,17 @@
</svelte:fragment>
<svelte:fragment slot="header">
{#if $$slots.header || ($$slots.actions && minimize)}
{#if $$slots.header}
<div class="header-row between">
{#if $$slots.header}<slot name="header" />{/if}
<div class="buttons-group xsmall-gap ml-4">
<slot name="tools" />
{#if $$slots.actions && minimize}
<div class="buttons-divider" />
<slot name="actions" />
{/if}
</div>
</div>
{/if}
{#if $$slots['custom-attributes'] && isCustomAttr}
{#if isSub}<div class="header-row"><slot name="custom-attributes" direction="row" /></div>{/if}
{:else if $$slots.attributes && minimize}<div class="header-row">
<slot name="attributes" direction="row" />
</div>{/if}
{/if}
</svelte:fragment>
<svelte:fragment slot="aside">

View File

@ -25,15 +25,13 @@
let asideFloat: boolean = false
let asideShown: boolean = false
let docWidth: number
$: if (docWidth < 1024 && !asideFloat) asideFloat = true
$: if (docWidth >= 1024 && asideFloat) {
$: if (panelWidth < 900 && !asideFloat) asideFloat = true
$: if (panelWidth >= 900 && asideFloat) {
asideFloat = false
asideShown = false
}
</script>
<svelte:window bind:innerWidth={docWidth} />
<div class="popupPanel" bind:clientWidth={panelWidth}>
<div class="popupPanel-title">
<Button

View File

@ -72,7 +72,6 @@
onMount(() => {
dispatch('open', { ignoreKeys: ['comments', 'number', 'title'] })
})
let minimize: boolean = false
</script>
{#if object !== undefined}
@ -80,9 +79,8 @@
icon={board.icon.Card}
title={object?.title}
{object}
bind:minimize
isHeader={minimize}
isAside={!minimize}
isHeader={false}
isAside={true}
on:close={() => dispatch('close')}
>
<svelte:fragment slot="navigator">

View File

@ -89,16 +89,14 @@
onMount(() => {
dispatch('open', { ignoreKeys: ['comments', 'name', 'description', 'number'] })
})
let minimize: boolean = false
</script>
{#if issue !== undefined}
<Panel
object={issue}
bind:minimize
isHeader
isAside={!minimize}
isSub={minimize}
isAside={true}
isSub={false}
bind:innerWidth
on:close={() => {
dispatch('close')

View File

@ -211,7 +211,6 @@
}
let panelWidth: number = 0
let innerWidth: number = 0
let minimize: boolean = false
</script>
<ActionContext
@ -225,9 +224,8 @@
{icon}
{title}
{object}
bind:minimize
isHeader={false}
isAside={!minimize}
isAside={true}
bind:panelWidth
bind:innerWidth
on:update={(ev) => _update(ev.detail)}