Coder Social home page Coder Social logo

alioguzhan / use-screen Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 836 KB

Custom React hook for screen and device information

Home Page: https://alioguzhan.github.io/use-screen/

License: MIT License

JavaScript 3.27% TypeScript 90.64% HTML 6.09%
react hooks screen responsive

use-screen's Introduction

use-screen

FreePalestine.Dev

Custom React hook for screen and device information

NPM npm codecov Github FreePalestine.Dev

Install

npm install use-screen

Or with yarn:

yarn add use-screen

Usage

import useScreen from 'use-screen';

const { isMobile, isWideScreen, screenWidth } = useScreen();

// use screen width and other variables as you like

See the website to see how it works: https://alioguzhan.github.io/use-screen/

There is also a working live example as a sandbox:

Edit use-screen-hook

Return Value

interface State {
  isMobile: boolean; // < 768px
  isTablet: boolean; // < 1280px
  isComputer: boolean; // > 1280px
  isLargeScreen: boolean; // < 1920px
  isWideScreen: boolean; // > 1920px
  screenWidth: number; // current screen width (innerWidth)
  screenHeight: number; // current screen height (innerHeight)
}

License

MIT © alioguzhan

use-screen's People

Contributors

alioguzhan avatar dependabot[bot] avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

use-screen's Issues

v2

It's been a long time since this hook was released and it is time to do some updates and upgrades.

  • upgrade dependencies
  • add a shell.nix file
  • replace standard-version with release-please
  • deploy via GitHub Actions (via release-please)
  • deprecate old node versions
  • revisit tests
  • integrate husky, lint-staged and commitlint
  • update breakpoints
  • use vite or microbundle (no need for rollup)
  • Allow custom breakpoints ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.