Allow to use maxWidth with Panel (#2411)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-12-01 23:45:56 +07:00 committed by GitHub
parent f25a7bcbe2
commit 31c7586ddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 5 deletions

View File

@ -36,6 +36,7 @@
export let isCustomAttr: boolean = true export let isCustomAttr: boolean = true
export let floatAside = false export let floatAside = false
export let allowClose = true export let allowClose = true
export let useMaxWidth = false
</script> </script>
<Panel <Panel
@ -47,6 +48,7 @@
on:close on:close
{allowClose} {allowClose}
{floatAside} {floatAside}
{useMaxWidth}
> >
<svelte:fragment slot="navigator"> <svelte:fragment slot="navigator">
{#if $$slots.navigator} {#if $$slots.navigator}
@ -127,19 +129,19 @@
<slot /> <slot />
</div> </div>
{:else} {:else}
<div class="popupPanel-body__main-content py-8 clear-mins"> <div class="popupPanel-body__main-content py-8 clear-mins" class:max={useMaxWidth}>
<slot /> <slot />
</div> </div>
{/if} {/if}
{:else if $deviceInfo.isMobile} {:else if $deviceInfo.isMobile}
<div class="popupPanel-body__mobile-content clear-mins"> <div class="popupPanel-body__mobile-content clear-mins" class:max={useMaxWidth}>
<Component is={activity.component.Activity} props={{ object, integrate: true }}> <Component is={activity.component.Activity} props={{ object, integrate: true }}>
<slot /> <slot />
</Component> </Component>
</div> </div>
{:else} {:else}
<Scroller> <Scroller>
<div class="popupPanel-body__main-content py-8 clear-mins"> <div class="popupPanel-body__main-content py-8 clear-mins" class:max={useMaxWidth}>
<Component is={activity.component.Activity} props={{ object, integrate: true }}> <Component is={activity.component.Activity} props={{ object, integrate: true }}>
<slot /> <slot />
</Component> </Component>

View File

@ -576,6 +576,11 @@
editor.chain().focus() editor.chain().focus()
}} }}
/> />
<slot name="tools" />
</div>
{:else}
<div class="formatPanel buttons-group xsmall-gap mb-4">
<slot name="tools" />
</div> </div>
{/if} {/if}
</div> </div>

View File

@ -296,6 +296,7 @@
</div> </div>
<div class="buttons-group large-gap ml-4 mt-2"> <div class="buttons-group large-gap ml-4 mt-2">
{#each actions as a} {#each actions as a}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="icon-button" on:click={(evt) => handleAction(a, evt)}> <div class="icon-button" on:click={(evt) => handleAction(a, evt)}>
<Icon icon={a.icon} size={'medium'} /> <Icon icon={a.icon} size={'medium'} />
</div> </div>

View File

@ -39,6 +39,7 @@
} }
</script> </script>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div <div
class="antiComponent styled-box clear-mins" class="antiComponent styled-box clear-mins"
on:click={() => { on:click={() => {

View File

@ -144,6 +144,10 @@
margin-right: auto; margin-right: auto;
width: calc(100% - 7.5rem); width: calc(100% - 7.5rem);
max-width: 860px; max-width: 860px;
&.max {
max-width: 100%;
}
} }
} }
@ -156,6 +160,10 @@
padding: .75rem 1.25rem; padding: .75rem 1.25rem;
width: calc(100% - 5rem); width: calc(100% - 5rem);
max-width: 900px; max-width: 900px;
&.max {
max-width: 100%;
}
} }
&.mobile { &.mobile {
flex-shrink: 0; flex-shrink: 0;

View File

@ -31,6 +31,7 @@
export let withoutTitle: boolean = false export let withoutTitle: boolean = false
export let floatAside = false export let floatAside = false
export let allowClose = true export let allowClose = true
export let useMaxWidth = false
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
@ -118,7 +119,7 @@
}} }}
> >
{#if $$slots.header && isHeader} {#if $$slots.header && isHeader}
<div class="popupPanel-body__header mobile bottom-divider"> <div class="popupPanel-body__header mobile bottom-divider" class:max={useMaxWidth}>
<slot name="header" /> <slot name="header" />
</div> </div>
{/if} {/if}
@ -133,7 +134,7 @@
}} }}
> >
{#if $$slots.header && isHeader} {#if $$slots.header && isHeader}
<div class="popupPanel-body__header main bottom-divider"> <div class="popupPanel-body__header main bottom-divider" class:max={useMaxWidth}>
<slot name="header" /> <slot name="header" />
</div> </div>
{/if} {/if}