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

[feat]: add useDevicePixelRatio hook #280

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rupeq
Copy link

@rupeq rupeq commented Jan 29, 2025

Summary:

  • added useDevicePixelRatio hook to detect device pixel ratio and support status
  • implemented tests for supported and unsupported environments
  • created a demo component to showcase the hook functionality
  • updated testing setup with MediaQueryListEvent mock

Testing evidence:
Demo#1
Demo#2
Tests

Issue:
#274

/**
* @name useDevicePixelRatio
* @description - Hook that returns the ratio of the resolution in physical pixels to the resolution in CSS pixels for the current display device
* @category Display
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure.
cc @debabin

setRatio(window.devicePixelRatio);
};

updatePixelRatio();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for initial mount.

@rupeq rupeq changed the title feat(useDevicePixelRatio): add useDevicePixelRatio hook with tests an… [feat]: add useDevicePixelRatio hook Feb 2, 2025
rupeq added 4 commits February 2, 2025 03:22
…d demo

- added `useDevicePixelRatio` hook to detect device pixel ratio and support status
- implemented tests for supported and unsupported environments
- created a demo component to showcase the hook functionality
- updated testing setup with `MediaQueryListEvent` mock
@rupeq rupeq force-pushed the feat/use-device-pixel-ratio branch from 773a2cb to 820d12e Compare February 2, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant