Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround hydration scrolling bug #4221

Merged
merged 3 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sites/kit.svelte.dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"name": "kit.svelte.dev",
"version": "0.0.1",
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build --verbose",
"dev": "node ./svelte-kit.js dev",
"build": "node ./svelte-kit.js build --verbose",
"prebuild": "test \"$CI\" = true && npx pnpm install --store=node_modules/.pnpm-store || echo skipping pnpm install",
"preview": "svelte-kit preview"
"preview": "node ./svelte-kit.js preview"
},
"devDependencies": {
"@sveltejs/adapter-auto": "workspace:*",
Expand Down
48 changes: 29 additions & 19 deletions sites/kit.svelte.dev/src/routes/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
import { Icon, Icons, Nav, NavItem, PreloadingIndicator, SkipLink } from '@sveltejs/site-kit';
import Search from '$lib/search/Search.svelte';
import SearchBox from '$lib/search/SearchBox.svelte';

let h = 0;
let w = 0;
$: browser && document.documentElement.style.setProperty('--ukr-footer-height', `${h}px`);
</script>

<Icons />
Expand Down Expand Up @@ -47,26 +43,26 @@
</NavItem>
</svelte:fragment>
</Nav>
<a target="_blank" rel="noopener noreferrer" href="https://www.stopputin.net/"
><div class="ukr" bind:clientHeight={h} bind:clientWidth={w}>
{#if w < 830}
<strong>We stand with Ukraine.</strong>
Donate →
{:else}
<strong>We stand with Ukraine.</strong>
Petition your leaders. Show your support.
{/if}
</div></a
>

<main id="main" style="padding-bottom: {h}px;">

<main id="main">
<slot />

{#if browser}
<SearchBox />
{/if}
</main>

<a target="_blank" rel="noopener noreferrer" href="https://www.stopputin.net/">
<div class="ukr">
<span class="small">
<strong>We stand with Ukraine.</strong> Donate →
</span>
<span class="large">
<strong>We stand with Ukraine.</strong> Petition your leaders. Show your support.
</span>
</div>
</a>

<style>
main {
position: relative;
Expand Down Expand Up @@ -136,22 +132,36 @@
font-size: 1.6rem !important;
}

/** Ukraine banner */
:root {
--ukr-footer-height: 48px;
}

main {
padding-bottom: var(--ukr-footer-height);
}

.ukr {
background-color: #0066cc;
color: white;
position: fixed;
display: flex;
align-items: center;
justify-content: center;
bottom: 0;
width: 100vw;
text-align: center;
padding: 0.75em;
height: var(--ukr-footer-height);
z-index: 999;
}

:global(.examples-container, .repl-outer, .tutorial-outer) {
height: calc(100vh - var(--nav-h) - var(--ukr-footer-height)) !important;
}

:global(.toggle) {
bottom: var(--ukr-footer-height) !important;
}

@media (max-width: 830px) {
:global(aside) {
z-index: 9999 !important;
Expand Down
14 changes: 14 additions & 0 deletions sites/kit.svelte.dev/svelte-kit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { spawn } from 'child_process';
import { fileURLToPath } from 'url';

const [node, , ...args] = process.argv;
const mode = process.env.CI ? 'dist' : 'src';
const bin = fileURLToPath(new URL(`../../packages/kit/${mode}/cli.js`, import.meta.url));

const child = spawn(node, [bin, ...args], {
stdio: 'inherit'
});

if (child) {
child.on('exit', process.exit);
}