{"id":13493373,"url":"https://github.com/komlev/tiny-use-media","last_synced_at":"2025-07-05T07:32:27.339Z","repository":{"id":38084198,"uuid":"454479856","full_name":"komlev/tiny-use-media","owner":"komlev","description":"Small (0.5 Kb) react hook for getting media breakpoints state info in runtime","archived":false,"fork":false,"pushed_at":"2024-12-13T20:46:05.000Z","size":28,"stargazers_count":53,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T11:08:50.230Z","etag":null,"topics":["breakpoints","hooks","media","usemedia"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/komlev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-01T17:17:36.000Z","updated_at":"2025-02-11T15:51:35.000Z","dependencies_parsed_at":"2025-01-02T05:11:35.847Z","dependency_job_id":"4375e4a2-f50e-4b90-b6e6-141941a0d202","html_url":"https://github.com/komlev/tiny-use-media","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"686cc96cf0b8f4243b11aab0022d08778c55f741"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-media","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-media/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-media/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Ftiny-use-media/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/komlev","download_url":"https://codeload.github.com/komlev/tiny-use-media/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703198,"owners_count":21148118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["breakpoints","hooks","media","usemedia"],"created_at":"2024-07-31T19:01:14.618Z","updated_at":"2025-04-13T11:09:05.064Z","avatar_url":"https://github.com/komlev.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# tiny-use-media\n\nSmall (0.5 Kb) react hook for getting media breakpoints state info in runtime\n\n## Usage\n\n```\nnpm i tiny-use-media --save\n```\n\nAdn in your react code\n\n```js\nimport { useMedia } from \"tiny-use-media\";\n\n// ...\n\nconst { current, md, lg } = useMedia({\n  sm: 640,\n  md: 768,\n  lg: 1024,\n  xl: 1280,\n});\n\nconsole.log({ current, md, lg });\n/*\n  if you current screen size is 900px\n  it will print:\n  { current: 'md', md: true, lg: false }\n*/\n```\n\n## API\n\nInput:\n\n```js\n// object with breakpoints names/values\nconst breakpointsConfig = {\n  mobile: 320, // min-width for mobile\n  tablet: 640, // min-width for tablet\n  desktop: 1024, // min-width for desktop\n};\n\nuseMedia(breakpointsConfig);\n```\n\nOutput:\n\n```js\nconst output = useMedia(breakpointsConfig);\n```\n\nOutput contains \"**current**\" field which corresponds to a current breakpoint.\n\nIt also contains boolean values for each provided breakpoint.\n\nE.g. output for screen size of 900px\n\n```js\n{\n    current: \"tablet\",\n    mobile: true,\n    tablet: true,\n    desktop: false\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomlev%2Ftiny-use-media","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkomlev%2Ftiny-use-media","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomlev%2Ftiny-use-media/lists"}