All Projects → Lectrum → breakpoints-json

Lectrum / breakpoints-json

Licence: MIT license
JSON formatted breakpoints

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to breakpoints-json

Vue Composable
Vue composition-api composable components. i18n, validation, pagination, fetch, etc. +50 different composables
Stars: ✭ 638 (+4153.33%)
Mutual labels:  breakpoint
Fgdownloader
用于断点下载、任务队列、上传进度、下载进度
Stars: ✭ 143 (+853.33%)
Mutual labels:  breakpoint
media-blender
Easy and predictable SASS/SCSS media queries
Stars: ✭ 26 (+73.33%)
Mutual labels:  breakpoint
Basictable
Basic Table jQuery or Vanilla JS plugin for simple responsive tables.
Stars: ✭ 94 (+526.67%)
Mutual labels:  breakpoint
React Flexa
Responsive React Flexbox (CSS Flexible Box Layout Module) grid system based heavily on the standard CSS API.
Stars: ✭ 120 (+700%)
Mutual labels:  breakpoint
Include Media
📐 Simple, elegant and maintainable media queries in Sass
Stars: ✭ 2,362 (+15646.67%)
Mutual labels:  breakpoint
Responsive Bootstrap Toolkit
Responsive Bootstrap Toolkit allows for easy breakpoint detection in JavaScript
Stars: ✭ 364 (+2326.67%)
Mutual labels:  breakpoint
asm2cfg
Python command-line tool and GDB extension to view and save x86, ARM and objdump assembly files as control-flow graph (CFG) pdf files
Stars: ✭ 42 (+180%)
Mutual labels:  breakpoint
Mq Scss
Extremely powerful Sass media query mixin. Allows you to create almost any media query you can imagine.
Stars: ✭ 122 (+713.33%)
Mutual labels:  breakpoint
Styled Components Breakpoint
Utility function for using breakpoints with styled-components 💅.
Stars: ✭ 231 (+1440%)
Mutual labels:  breakpoint
Match Media
Universal polyfill for match media API using Expo APIs on mobile
Stars: ✭ 95 (+533.33%)
Mutual labels:  breakpoint
Sscss
Light Sass lib for managing your font-size, margin, padding, and position values across breakpoints.
Stars: ✭ 119 (+693.33%)
Mutual labels:  breakpoint
Gridtab
GridTab is a lightweight jQuery plugin to create grid based responsive tabs https://gopalraju.github.io/gridtab
Stars: ✭ 210 (+1300%)
Mutual labels:  breakpoint
Vue Breakpoint
😸 A renderless Vue.js component for composing CSS breakpoints
Stars: ✭ 74 (+393.33%)
Mutual labels:  breakpoint
styled-media-helper
💅 Helps manage media queries with styled components
Stars: ✭ 76 (+406.67%)
Mutual labels:  breakpoint
Styled Breakpoints
Simple and powerful tool for creating breakpoints in styled components and emotion. 💅
Stars: ✭ 428 (+2753.33%)
Mutual labels:  breakpoint
Dephpugger
Php Debugger to run in terminal to debug your code easily.
Stars: ✭ 181 (+1106.67%)
Mutual labels:  breakpoint
breaking-point
BREAKING-POINT lets you quickly define and subscribe to screen (i.e. window) breakpoints in your re-frame application
Stars: ✭ 36 (+140%)
Mutual labels:  breakpoint
redux-usage-report
A Redux Devtools monitor to audit your app's usage of the store
Stars: ✭ 41 (+173.33%)
Mutual labels:  breakpoint
Flexi
Just a layout framework. Design for cross-platform with ease.
Stars: ✭ 220 (+1366.67%)
Mutual labels:  breakpoint

breakpoints-json

Status Maintained npm version PRs Welcome Build Status Join the chat at https://gitter.im/lectrum/breakpoints-json Twitter URL

Adds some magic to adaptive applications

This is a lightweight package with the most useful breakpoints in a universal JSON format. They correspond to popular modern devices (look on the picture below). We have carefully determined the best breakpoints during the last three years.

breakpoints-json 3

Installation

You can install breakpoints-json using npm:

npm install --save breakpoints-json

or you can use yarn:

yarn add breakpoints-json

Usage

This package is polymorphic. It can be used with native JavaScript, any tool/library or any other programming language.

For use this package you just need to import it from 'node_modules'.

import breakpoints from 'breakpoints-json';

or if you don`t use ES6:

var breakpoints = require('breakpoints-json');.

If you use babel, JSON should be automatically transformed to JavaScript object after you import it.

Here is a simple example - check() function which returns a breakpoint (type Object) to you that corresponds to your current window size.

import breakpoints from 'breakpoints-json';

const check = (size) => {
    let result = false;

    for (let key in breakpoints) {
        const item = breakpoints[key];
        const max = item.max;
        const min = item.min;

        if (size <= max && size >= min) {
            result = item;
        }
    }

    return result;
};

export default check;

It might be useful for building some logic according to different devices. You can easily make conditional rendered component (one component for mobile and another for desktop and tablet devices) in React.js as in the example below. We will use our check() function for this task:

import React, { Component } from 'react';
import breakpoints from 'breakpoints-json';
import check from './check.js';

export default class App extends Component {
    render () {
        const current = window.innerWidth;
        const name = check(current).name;
        const phonePortrait = breakpoints.phonePortrait.name;
        const phoneLandscape = breakpoints.phoneLandscape.name;

        const conditionalRender = () => {
            return name === phonePortrait || name === phoneLandscape
            ?
                <AppMobile />
            :
                <AppDesktop />;
        };

        return conditionalRender;
    }
}

We also created a React component in smart-render npm package that does this logic. This approach is better than writing display: none; in CSS. If you use this package, HTML element that should be not rendered — will not be in the DOM, in contrast to CSS display: none; rule (in this case HTML element will be presented in the DOM, but just not show).

Contributing

If you want to suggest an improvement to this package, feel free to fork this repo. To run tests execute the following in your terminal:

npm test.

Then send us PR. It is an excellent possibility to giving your karma a little push, and you'll help us a lot.

If you enjoy this package, feel free to star it. But if you want to create your own package like this or a complicated one join our Lectrum club and we will help you. We are very fast in supporting open-source projects. You can be sure that we will help you in our gitter and twitter within 24 hours.

License

This project is licensed under the terms of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].