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

Footer Layout Issue #2

Open
Mooshieblob1 opened this issue Oct 30, 2024 · 0 comments
Open

Footer Layout Issue #2

Mooshieblob1 opened this issue Oct 30, 2024 · 0 comments
Assignees
Labels
bug Something isn't working layout typescript

Comments

@Mooshieblob1
Copy link
Owner

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

  1. Fixed positioning causing content overlap
  2. Manual padding needed to prevent content from being hidden
  3. Potential z-index conflicts
  4. Layout breaks with dynamic content
  5. 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

  1. Layout Structure Review

    • Audit entire layout hierarchy
    • Check for conflicting styles
    • Review parent container configurations
  2. TypeScript Configuration

    • Verify all type definitions are correct
    • Check for any type-related constraints affecting layout
  3. Component Integration

    • Review how Footer integrates with PageWrapper
    • Examine slot content handling
    • Check for any SvelteKit-specific layout issues
  4. 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

  1. Test with varying content lengths
  2. Test across different screen sizes
  3. Verify dark mode transitions
  4. Check for scroll behavior
  5. 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.

@Mooshieblob1 Mooshieblob1 added bug Something isn't working layout typescript labels Oct 30, 2024
@Mooshieblob1 Mooshieblob1 self-assigned this Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working layout typescript
Projects
None yet
Development

No branches or pull requests

1 participant