npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

custom-responsive

v1.0.9

Published

Media queries in react for responsive design

Downloads

6

Readme

custom-responsive

描述

该hook新增对象,数组和字符串的传参形式,保留原本react-responsive的传参,满足日常的开发需求;

安装

       npm i custom-responsive
       yarn add custom-responsive

使用

  @params
       传入、字符串以及数组
       1.@expamle 对象
              useMedia({ small: "(max-width: 599px)",
              medium: "(min-width: 600px) and (max-width: 1199px)",
              large: "(min-width: 1200px)"})
              
       2.@expamle 数组
              1. useMedia([,200])
              2. useMedia([200,])
              3. useMedia([200,400]) 
        
              数组中第三个参数:0为高度,1为宽度,默认为宽度,目前只兼容常用的方式
              @example:
              useMedia([,1200,0])
       3.@expamle 字符串
              1. useMedia("min-width:1224px")
              2. useMedia("max-width:1224px")       
       4.保留react-responsive的参数传递形式
              useMedia({query: '(min-width: 1224px)'})
              useMedia({ minWidth: 1224 })
              useMedia({ orientation: 'portrait' })
              useMedia({ minResolution: '2dppx' })
       @returns
       布尔值或者对象
              1.@expamle

              const media = useMedia("max-width:1224px")
              media为true/false

              2.@expamle
              
              const media = useMedia({ small: "(max-width: 599px)",
              medium: "(min-width: 600px) and (max-width: 1199px)",
              large: "(min-width: 1200px)"})
              result:
              media = {small:false,medium:true,large:false}