diff --git a/README.md b/README.md index 24405e0..851afcb 100644 --- a/README.md +++ b/README.md @@ -21,39 +21,39 @@ This module is pretty straightforward: You specify a set of requirements, and th ## Usage -A mq element functions like any other React component, which means you can nest them and do all the normal jazz. +A Mq element functions like any other React component, which means you can nest them and do all the normal jazz. ### Using CSS Media Queries -```js -var mq = require('react-responsive'); +```jsx +var Mq = require('react-responsive'); var A = React.createClass({ render: function(){ return (
Device Test!
- +
You are a desktop or laptop
- +
You also have a huge screen
-
- + +
You are sized like a tablet or mobile phone though
-
-
- + +
+
You are a tablet or mobile phone
-
- + +
You are portrait
-
- + +
You are landscape
-
- + +
You are retina
-
+
); } @@ -71,35 +71,78 @@ For a list of all possible shorthands and value types see https://github.com/wea Any numbers given as a shorthand will be expanded to px (`1234` will become `'1234px'`) -```js -var mq = require('react-responsive'); +```jsx +var Mq = require('react-responsive'); var A = React.createClass({ render: function(){ return (
Device Test!
- +
You are a desktop or laptop
- +
You also have a huge screen
-
- + +
You are sized like a tablet or mobile phone though
-
-
- + +
+
You are a tablet or mobile phone
-
- + +
You are portrait
-
- + +
You are landscape
-
- + +
You are retina
-
+
+
+ ); + } +}); +``` + +### Server rendering + +Server rendering can be done by passing static values through the `values` property. + +The values property can contain `orientation`, `scan`, `aspectRatio`, `deviceAspectRatio`, +`height`, `deviceHeight`, `width`, `deviceWidth`, `color`, `colorIndex`, `monochrome`, +and `resolution` to be matched against the media query. + +```jsx +var Mq = require('react-responsive'); + +var A = React.createClass({ + render: function(){ + return ( +
+
Device Test!
+ +
You are a desktop or laptop
+ +
You also have a huge screen
+
+ +
You are sized like a tablet or mobile phone though
+
+
+ +
You are a tablet or mobile phone
+
+ +
You are portrait
+
+ +
You are landscape
+
+ +
You are retina
+
); } @@ -145,4 +188,4 @@ Pretty much everything. Check out these polyfills: [downloads-image]: http://img.shields.io/npm/dm/react-responsive.svg [npm-url]: https://npmjs.org/package/react-responsive -[npm-image]: http://img.shields.io/npm/v/react-responsive.svg \ No newline at end of file +[npm-image]: http://img.shields.io/npm/v/react-responsive.svg