Giter Site home page Giter Site logo

haneenmahd / responsive-web Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 29 KB

A Simple npm package for using responsive media screen sizes in your web app.

Home Page: https://haneenmahd.github.io/responsive-web/

TypeScript 100.00%
media screen size responsive react vue angular polymer webpack design

responsive-web's Introduction

@haneenmahd/responsive-web

A Simple npm package for using responsive media screen sizes in your web app.

Node.js Package Node.js CI

Now a Easier way to use media queries in your

  • Easy to use
  • Media screen sizes are completely made accurate for devices
  • Make your website Responsive to all devices

Installation

Using npm

npm install @haneenmahd/responsive-web

Using yarn

yarn add @haneenmahd/responsive-web

How to Use

Example:

import React from "react";
import styled from "styled-components";
import { Colors } from "apple-colors";
import QUERIES, { getWindowHeight, getWindowWidth, getWindowScrollPosX, getWindowScrollPosY, useScrollBy, useScrollTo } from "responsive-web";

const Wrapper = styled.div`
  height: 300px;
  width: 300px;
  padding: 1.5rem 2rem;
  border-radius: 1rem;
  background: ${Colors.iOS.Light.Grey1};
  @media screen and (${QUERIES.MOBILE}) {
      background: ${Colors.iOS.Light.Grey1};

  }
`;
const Header = styled.h1`
  font-size: 25px;
  color: #fff;
  @media screen and (${QUERIES.MOBILE}) {
      font-size: 18px;
  }
`;
const Paragraph = styled.p`
  font-size: 18px;
  color: #fff;
  @media screen and (${QUERIES.MOBILE}) {
      font-size: 14px;
  }
`;

const MyDeviceQuery = () => {
  const windowWidth = getWindowWidth();
  const windowHeight = getWindowHeight();
  const windowScrollPos = getWindowScrollPos();
  return (
    <Wrapper>
     <Header>Hello World</Header>
     {windowWidth > 550 && <p>Hello! Window width greater than 550px</p>} 
     {windowHeight > 500 && <p>Hello! Window height greater than 500px</p>}
     <p>Scroll amount x: {getWindowScrollX()}</p>
     <p>Scroll amount y: {getWindowScrollY()}</p>
     <Paragraph>
     I am using queries to make my website responsive.
     </Paragraph>
     <button onclick={useScrollBy(20, 50)}>Scroll by</button>
     <button onclick={useScrollTo(0, 50)}>Scroll To</button>
    </Wrapper>
  );
}

Available Sizes

Default:

  • MOBILE
  • TABLET
  • LAPTOP
  • DESKTOP
  • TV

You could Access these properties by: QUERIES.OBJECTDEFINEDABOVE

Cusom Device Sizes

IOS:

  • FOUR (iPhone 4 Models)
    • LANDSCAPE
    • PORTRAIT
  • FIVE (iPhone 5 to 7 Models)
    • LANDSCAPE
    • PORTRAIT
  • EIGHT (iPhone 8 Models, excluding plus models)
    • LANDSCAPE
    • PORTRAIT
  • PLUS (iPhone 7 and 8 PLUS)
    • LANDSCAPE
    • PORTRAIT
  • X (iPhone X Models)
    • LANDSCAPE
    • PORTRAIT

SAMSUNG:

  • S3 (Also contains Note4 and Note5 Models Too.)
    • LANDSCAPE
    • PORTRAIT
  • NOTE3
    • LANDSCAPE
    • PORTRAIT
  • S6
    • LANDSCAPE
    • PORTRAIT

TABLETS:

  • IPAD
    • MINI (This contains iPad 1, 2, Mini and Air too.)
      • LANDSCAPE
      • PORTRAIT
    • IPAD4 (This contains iPad 3, 4 and iPad Pro 9.5" Models too.)
      • PORTRAIT
      • LANDSCAPE
    • PRO10
      • LANDSCAPE
      • PORTRAIT
    • PRO12
      • PORTRAIT
      • LANDSCAPE

LAPTOPS

  • NONRETINA (Devices which have non-retina display)
  • RETINA (Devices Which have Retina display)

Developer

Haneen Mahdin

Follow me on:

License

responsive-web is licensed under MIT.

responsive-web's People

Contributors

haneenmahd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

inncee81

responsive-web's Issues

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.