|
5 | 5 | import { IconX } from '@appwrite.io/pink-icons-svelte'; |
6 | 6 | import { isTabletViewport } from '$lib/stores/viewport'; |
7 | 7 | import PinkBackground from '$lib/images/pink-background.svg'; |
8 | | - import { bannerSpacing } from '$lib/layout/headerAlert.svelte'; |
9 | 8 | import { createEventDispatcher, onMount, onDestroy } from 'svelte'; |
| 9 | + import { headerAlert } from '$lib/stores/headerAlert'; |
| 10 | + import { ProfileMode, resolvedProfile } from '$lib/profiles/index.svelte'; |
10 | 11 |
|
11 | 12 | export let variant: 'gradient' | 'image' = 'gradient'; |
12 | 13 |
|
|
16 | 17 | const queryLayoutElements = () => ({ |
17 | 18 | header: document.querySelector<HTMLElement>('main > header'), |
18 | 19 | sidebar: document.querySelector<HTMLElement>('main > div > nav'), |
19 | | - content: document.querySelector<HTMLElement>('main > div > section') |
| 20 | + content: document.querySelector<HTMLElement>('main > div > section'), |
| 21 | + contentDiv: document.querySelector<HTMLElement>('main > .content') |
20 | 22 | }); |
21 | 23 |
|
22 | 24 | const setNavigationHeight = () => { |
23 | 25 | const alertHeight = container?.getBoundingClientRect()?.height || 0; |
24 | | - const { header, sidebar, content } = queryLayoutElements(); |
| 26 | + const { header, sidebar, content, contentDiv } = queryLayoutElements(); |
25 | 27 | const headerHeight = header?.getBoundingClientRect().height || 0; |
26 | 28 | const offset = alertHeight + (!$isTabletViewport && header ? headerHeight : 0); |
27 | 29 |
|
|
34 | 36 | sidebar.style.height = `calc(100vh - ${offset}px)`; |
35 | 37 |
|
36 | 38 | // for sidebar and sub-navigation! |
37 | | - bannerSpacing.set(`${alertHeight}px`); |
| 39 | + headerAlert.setTopSpacing(alertHeight); |
38 | 40 | } |
39 | 41 |
|
40 | 42 | if (content) { |
41 | 43 | content.style.paddingBlockStart = `${alertHeight}px`; |
42 | 44 | } |
| 45 | +
|
| 46 | + if (contentDiv && resolvedProfile.id === ProfileMode.STUDIO) { |
| 47 | + const headerHeight = header?.getBoundingClientRect().height ?? 48; |
| 48 | + // push the content enough to show the borders of the content view! |
| 49 | + contentDiv.style.marginBlockStart = `${alertHeight + headerHeight}px`; |
| 50 | + } |
43 | 51 | }; |
44 | 52 |
|
45 | 53 | onMount(setNavigationHeight); |
|
0 commit comments