{
+ render() {
+ const isPalm = findMatch('palm');
+
+ if (isPalm) console.log( 'only logged in palm' );
+
+ return (
+
+
Only visible in palm:
+ { isPalm
+ ? Palm
+ : null }
+
+ Allows Multiple Matches
+ { findMatch('desk', 'lap')
+ ? Lap or Desk
+ : null }
+
+ );
+ }
+}
+
+const isMobile = /iP(hone|od)|Mobile/;
+function textFxn(req, res) {
+ if ( isMobile.test( req.headers['user-agent'] ) ) {
+ setBreakpoints(['palm', 'portable'])
+ }
+ else {
+ setBreakpoints(['desk'])
+ }
+ const html = ReactDOMServer.renderToString( );
+
+ res.send( '' + html );
+}
+
+const breakpoints: string[] | boolean = findBreakpoints();
+
+class App2 extends React.Component {
+ componentDidMount() {
+ optimizedResize.init( () => {
+ if ( findBreakpoints() ) {
+ console.log('New Breakpoints');
+ this.forceUpdate();
+ }
+ });
+ }
+}
+
+const breakpoints2: string[] = getCurrentBreakpoints();
+
+const someStrings: string[] = [palm, lap, portable, desk];
diff --git a/react-flexr/react-flexr.d.ts b/react-flexr/react-flexr.d.ts
new file mode 100644
index 0000000000..ac8bda60ce
--- /dev/null
+++ b/react-flexr/react-flexr.d.ts
@@ -0,0 +1,59 @@
+// Type definitions for react-flexr v2.0.2
+// Project: https://github.com/kodyl/react-flexr
+// Definitions by: Jeffery Grajkowski
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+///
+
+declare namespace __ReactFlexr {
+ export import React = __React;
+
+ interface GridProps extends React.Props {
+ align?: "top" | "center" | "bottom";
+ hAlign?: "left" | "center" | "right";
+ gutter?: string;
+ flexCells?: boolean;
+ }
+
+ export class Grid extends React.Component {
+ }
+
+ interface CellProps extends React.Props {
+ align?: "top" | "center" | "bottom";
+ gutter?: string;
+ flex?: boolean;
+ size?: string | number;
+ palm?: string | number;
+ lap?: string | number;
+ portable?: string | number;
+ desk?: string | number;
+ }
+
+ export class Cell extends React.Component {
+ }
+
+ interface OptimizedResize {
+ init: (callback: () => void) => void;
+ }
+
+ export const optimizedResize: OptimizedResize;
+
+ export type ErgonomicType = "palm" | "lap" | "portable" | "desk";
+
+ export const findMatch: (...arguments: ErgonomicType[]) => boolean;
+
+ export const setBreakpoints: (breakpoints: ErgonomicType[]) => void;
+
+ export const findBreakpoints: () => ErgonomicType[] | boolean;
+
+ export const getCurrentBreakpoints: () => ErgonomicType[];
+
+ export const palm: string;
+ export const lap: string;
+ export const portable: string;
+ export const desk: string;
+}
+
+declare module "react-flexr" {
+ export = __ReactFlexr;
+}
|