-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Footer Layout Issue
Current Issue
The footer component is experiencing layout issues when used with the current TypeScript configuration. The footer either overlaps content or doesn't stay at the bottom of the page consistently.
Current Implementation
Footer Component
<!-- src/lib/components/layout/Footer.svelte -->
<script lang="ts">
const startYear = 2024;
const currentYear = new Date().getFullYear();
const yearDisplay =
currentYear > startYear ? `${startYear} - ${currentYear}` : startYear.toString();
</script>
<footer class="fixed bottom-0 left-0 right-0 bg-white dark:bg-gray-800 shadow-lg z-10">
<div class="max-w-7xl mx-auto py-4 px-4">
<p class="text-center text-sm text-gray-600 dark:text-gray-400">
© Mooshieblob {yearDisplay}
</p>
</div>
</footer>
<!-- Add padding to prevent content from being hidden behind the footer -->
<div class="pb-[60px]"><!-- Increased padding slightly for better spacing --></div>Current Configuration
// svelte.config.ts
import adapter from '@sveltejs/adapter-cloudflare';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import type { Config } from '@sveltejs/kit';
const config: Config = {
kit: {
adapter: adapter()
},
preprocess: vitePreprocess()
};
export default config;Problems Identified
- Fixed positioning causing content overlap
- Manual padding needed to prevent content from being hidden
- Potential z-index conflicts
- Layout breaks with dynamic content
- Not responsive to varying content heights
Attempted Solutions
Solution 1: Flexbox Layout
<!-- PageWrapper.svelte -->
<div class="min-h-screen flex flex-col">
<main class="flex-grow">
<slot />
</main>
<Footer />
</div>Result: Partial success but still experiencing layout issues.
Solution 2: Grid Layout
<!-- PageWrapper.svelte -->
<div class="min-h-screen grid grid-rows-[1fr_auto]">
<main>
<slot />
</main>
<Footer />
</div>Result: Footer positioning improved but content overlap persists.
Next Steps
-
Layout Structure Review
- Audit entire layout hierarchy
- Check for conflicting styles
- Review parent container configurations
-
TypeScript Configuration
- Verify all type definitions are correct
- Check for any type-related constraints affecting layout
-
Component Integration
- Review how Footer integrates with PageWrapper
- Examine slot content handling
- Check for any SvelteKit-specific layout issues
-
Proposed Solution
<!-- PageWrapper.svelte -->
<script lang="ts">
import Footer from './Footer.svelte';
export let title: string = '';
</script>
<div class="min-h-screen bg-gray-100 dark:bg-gray-900 transition-colors duration-200 flex flex-col">
<main class="flex-1 max-w-7xl mx-auto w-full px-4 py-6 sm:px-6 lg:px-8">
{#if title}
<h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-6">{title}</h1>
{/if}
<slot />
</main>
<Footer />
</div><!-- Footer.svelte -->
<script lang="ts">
const startYear = 2024;
const currentYear = new Date().getFullYear();
const yearDisplay = currentYear > startYear
? `${startYear} - ${currentYear}`
: startYear.toString();
</script>
<div class="w-full">
<footer class="bg-white dark:bg-gray-800 shadow-lg">
<div class="max-w-7xl mx-auto py-4 px-4">
<p class="text-center text-sm text-gray-600 dark:text-gray-400">
© Mooshieblob {yearDisplay}
</p>
</div>
</footer>
</div>Testing Required
- Test with varying content lengths
- Test across different screen sizes
- Verify dark mode transitions
- Check for scroll behavior
- Test with dynamic content loading
Help Needed
- Input on best practices for footer positioning in SvelteKit applications
- Review of TypeScript configuration for potential issues
- Suggestions for alternative layout approaches
- Experience with similar footer positioning issues in SvelteKit
Environment Details
- SvelteKit (latest)
- TypeScript
- Tailwind CSS
- @sveltejs/adapter-cloudflare
- Node.js 18+
Please comment with any suggestions or if you've encountered and solved similar issues.
Reactions are currently unavailable