@biodiversity/ssr-breakpoints
v0.1.0
Published
Detect device and infer screen resolution on server or device and screen resolution breaks on client
Downloads
2
Readme
@biodiversity-nuxtjs/ssr-breakpoints
Detect device and infer screen resolution on server or device and screen resolution breaks on client.
Features
- get bulma breakpoints in js from server or client
Setup
- Add
@biodiversity/ssr-breakpoints
dependency using yarn or npm to your project
yarn add @biodiversity/ssr-breakpoints
npm install @biodiversity/ssr-breakpoints
- Add
@biodiversity/ssr-breakpoints
tomodules
section ofnuxt.config.js
{
modules: [
// Simple usage
'@biodiversity/ssr-breakpoints',
// With options
['@biodiversity/ssr-breakpoints', { /* module options none yet*/ }],
]
}
Usage
<template>
<section>
<div v-if="$breakpoints.isDesktopHD">
Desktop High Definition > 1408px
</div>
<div v-if="$breakpoints.isDesktopWS">
Desktop Wide Screen 1216px from to 1407px
</div>
<div v-if="$breakpoints.isDesktop">
Desktop 1024px and until 1215px
</div>
<div v-if="$breakpoints.isTouch">
Touch < 1024px
</div>
<div v-if="$breakpoint.isTablet">
Tablet 769px from to 1023px
</div>
<div v-if="$breakpoint.isMobile">
Mobile < 768px
</div>
</section>
</template>
Contribute
Submit a PR to the SCBD in https://github.com/scbd/biodiversity-nuxtjs/
TODO
- separate cookie logic that works on server and client into separate module
License
Copyright (c) Convention on Biological Diversity [email protected]