import * as React from "react";
import MediaQuery, {
toQuery
} from "react-responsive";
class QueryTests extends React.Component {
render() {
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
You are a desktop or laptop
You also have a huge screen
You are sized like a tablet or mobile phone though
);
}
}
const ChildrenPropTest: React.SFC = ({ children }) => ;
class PropsTests extends React.Component {
render() {
return (
Item 1
Item 2
Item 1
Item 2
Item 1
Item 2
Wrapped
Content
uppercase me!
Values supplied for SSR
);
}
}
class FunctionChildrenTest extends React.Component {
render() {
return (
{(matches: boolean) => {
if (matches) {
return Media query matches!
;
} else {
return Media query does not match!
;
}
}}
);
}
}
class CallbackTest extends React.Component {
onBeforeChange = (matches: boolean): void => {
if (matches) {
// do something
}
}
onChange = (matches: boolean): void => {
if (matches) {
// do something else
}
}
render() {
return (
Media query matches!
);
}
}
const queryStrTest: string = toQuery({
type: 'print',
screen: true,
minHeight: 666
});