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

next: Refactor is-mobile hook to use new MediaQuery class #1615

Open
1 task
Wombosvideo opened this issue Jan 12, 2025 · 0 comments
Open
1 task

next: Refactor is-mobile hook to use new MediaQuery class #1615

Wombosvideo opened this issue Jan 12, 2025 · 0 comments
Labels
type: feature Introduction of new functionality to the application

Comments

@Wombosvideo
Copy link

Wombosvideo commented Jan 12, 2025

Prerequisites

  • This feature already exists in shadcn/ui - if not, it won't be considered here so don't continue with your issue.

Describe the feature

Hey, since the Svelte team added the MediaQuery class, the IsMobile hook is now somewhat redundant.

To keep compatibility with all dependent components, I suggest extending the MediaQuery class:

import { MediaQuery } from "svelte/reactivity";

const MOBILE_BREAKPOINT = 768;

export class IsMobile extends MediaQuery {
	constructor() {
		super(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
	}
}

Notice that this might be a breaking change for users refusing to update their dependencies.

But since next is still next and not main, this change is acceptable in my opinion.

@Wombosvideo Wombosvideo added the type: feature Introduction of new functionality to the application label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

1 participant