GithubHelp home page GithubHelp logo

roylee0704 / react-flexbox-grid Goto Github PK

View Code? Open in Web Editor NEW
2.9K 30.0 204.0 930 KB

A set of React components implementing flexboxgrid with the power of CSS Modules.

Home Page: http://roylee0704.github.io/react-flexbox-grid/

JavaScript 88.57% HTML 1.96% TypeScript 7.04% SCSS 2.44%
css-modules flexbox-grid react-components

react-flexbox-grid's Introduction

react-flexbox-grid

npm version Build Status NPM Status

react-flexbox-grid is a set of React components that implement flexboxgrid.css. It even has an optional support for CSS Modules with some extra configuration.

http://roylee0704.github.io/react-flexbox-grid/

Setup

Installation

react-flexbox-grid can be installed as an npm package:

npm install --save react-flexbox-grid

Minimal configuration

The recommended way to use react-flexbox-grid is with a tool like webpack or Meteor, make sure you set it up to support requiring CSS files. For example, the minimum required loader configuration for webpack would look like this:

{
  test: /\.css$/,
  loader: 'style-loader!css-loader',
  include: /flexboxgrid/
}

react-flexbox-grid imports the styles from flexboxgrid, that's why we're configuring the loader for it.

CSS Modules

If you want to use CSS Modules (this is mandatory for versions earlier than v1), webpack's css-loader supports this by passing modules param in the loader configuration.

First, install style-loader and css-loader as development dependencies:

npm install --save-dev style-loader css-loader

Next, add a loader for flexboxgrid with CSS Modules enabled:

{
  test: /\.css$/,
  loader: 'style-loader!css-loader?modules',
  include: /flexboxgrid/
}

Make sure you don't have another CSS loader which also affects flexboxgrid. In case you do, exclude flexboxgrid, for example:

{
  test: /\.css$/,
  loader: 'style-loader!css-loader!postcss-loader',
  include: path.join(__dirname, 'node_modules'), // oops, this also includes flexboxgrid
  exclude: /flexboxgrid/ // so we have to exclude it
}

Otherwise you would end up with an obscure error because webpack stacks loaders together, it doesn't override them.

Isomorphic support

Try: this comment.

If this doesn't work for you, use the build located in the dist directory. This build removes all .css imports and extracts the relevant css into react-flexbox-grid/dist/react-flexbox-grid.css.

Not using a bundler?

Use the pre-bundled build located in the dist directory. It contains a single umd js distributable and built css file.

Usage

Now you can import and use the components:

import React from 'react';
import { Grid, Row, Col } from 'react-flexbox-grid';

class App extends React.Component {
  render() {
    return (
      <Grid fluid>
        <Row>
          <Col xs={6} md={3}>
            Hello, world!
          </Col>
        </Row>
      </Grid>
    );
  }
}

Gotcha

For the time being always use fluid for <Grid> to prevent horizontal overflow issues.

Example

Looking for a complete example? Head over to react-flexbox-grid-example.

Advanced composition

We also export functions for generating Row and Column class names for use in other components.

For example, suppose you're using a third party component that accepts className and you would like it to be rendered as Col. You could do so by extracting the column sizing props that MyComponent uses and then pass the generated className on to SomeComponent

import React from 'react';
import { Row, Col, getRowProps, getColumnProps } from 'react-flexbox-grid';
// a component that accepts a className
import SomeComponent from 'some-package';

export default function MyComponent(props) {
  const colProps = getColumnProps(props);
  const rowProps = getRowProps(props);

  return (
    <form className={rowProps.className}>
      <SomeComponent classname={colProps.className} />
      <input value={props.value} onChange={props.onChange} />
    </form>
  );
}

MyComponent.propTypes = Object.assign({
  onChange: React.PropTypes.func.isRequired,
  value: React.PropTypes.string.isRequired,
}, Col.propTypes, Row.propTypes);  // Re-use existing Row and Col propType validations

// Can now be rendered as: <MyComponent end="sm" sm={8} value="my input value" onChange={...} />

Contributors

Roy Lee Helder Santana Matija Marohnić
Roy Lee Helder Santana Matija Marohnić

License

MIT

react-flexbox-grid's People

Contributors

akolpakov avatar ankitduseja avatar arshsingh avatar avocadowastaken avatar beckend avatar danny-andrews avatar eemeli avatar gingur avatar heldr avatar hycner avatar irus avatar kgregory avatar mastrauckas avatar mbrookes avatar mrfambo avatar nathanstitt avatar roylee0704 avatar silvenon avatar vipoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-flexbox-grid's Issues

There's no Container component

Hi. I was following the README when I stumbled upon this code example:

import React from `react`;
import {Container} from `react-flexbox-grid/lib/index`;

React.render(<Container />, document.querySelector('#main'));

As far I've looked in the code, there isn't a Container component.

Probably this is a typo which should be corrected to Grid.

v0.10.1 no lib files

Installing through [email protected].
v0.10.1 has no lib folder built.

V0.9.6:

node_modules/react-flexbox-grid/lib/components
node_modules/react-flexbox-grid/lib/components/Col.js
node_modules/react-flexbox-grid/lib/components/Grid.js
node_modules/react-flexbox-grid/lib/components/Row.js
node_modules/react-flexbox-grid/lib/index.js

Module not found: Error: ?

ERROR in .//react-flexbox-grid/lib/components/Row.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../style in /Users/xxx/Code/G5/node_modules/react-flexbox-grid/lib/components
@ ./
/react-flexbox-grid/lib/components/Row.js 21:13-32

Components rendered with empty classes

This is my React code:

<Grid>
  <Row>
     <Col md={12} lg={6}><h1>Hey!</h1></Col>
     <Col md={12} lg={6}>Ups</Col>
  </Row>
</Grid>

And this is output:

<div class="" data-reactid=".0.1">
  <div class="" data-reactid=".0.1.0">
    <div class=" " data-reactid=".0.1.0.0"><h1 data-reactid=".0.1.0.0.0">Hey!</h1></div>
    <div class=" " data-reactid=".0.1.0.1">Ups</div>
  </div>
</div>

For some reason the classes are not filled (but notice the space).

This might be relevant. After I installed react-flexbox-grid, I got an error message (I'm using webpack):

ERROR in ./~/react-flexbox-grid/lib/components/Grid.js
Module not found: Error: Cannot resolve module 'classnames' in /home/tobik/scala/payola-viz/src/node_modules/react-flexbox-grid/lib/components
 @ ./~/react-flexbox-grid/lib/components/Grid.js 9:18-39

I fixed it by adding classnames to my dependencies. After that I was able to build the package but it behaves the way described above.

My version is 0.9.2.

Does not work

Hi,

Followed your examples.

But it does not work.

import React from 'react';
import { Grid, Row, Col } from 'react-flexbox-grid/lib/index';

import React from 'react';
import { Grid, Row, Col } from 'react-flexbox-grid/lib/index';

const Home = () => (
  <div>
    <Grid>
      <Row>
        <Col xs={6} md={3}>Hello, world!</Col>
        <Col xs={6} md={3}>Hello, world!</Col>
        <Col xs={6} md={3}>Hello, world!</Col>
        <Col xs={6} md={3}>Hello, world!</Col>
      </Row>
    </Grid>
  </div>
);

export default Home;

This just prints out empty divs without any class attributes.

Modifying Grid Settings

Is there a way to modify the grid settings like the number of columns and the column gap/gutter? I don't see anything documented regarding this.

Styles inheritance by other components issue

I just started experimenting with react-flexbox-grid along with material-ui which gives me nice set of material design components.

My code looks like this :

const App = React.createClass({
  render: function () {
    return (
      <MuiThemeProvider>
        <Row center='xs'>
          <Col xs={12} sm={10} md={10} lg={8}>
            <Card>
              <CardHeader
                title='Card Title'
                subtitle='Card Subtitle'
              />
              <CardActions>
                <TestComponent />
              </CardActions>
            </Card>
          </Col>
        </Row>
      </MuiThemeProvider>
    );
  }
});

As you can see, I want my Card to be centered so I wrapped it with the Row and Col as it is in the examples. Unfortunately the effect is this :

screen shot 2016-10-08 at 20 53 35

The styles used by react-flexbox-grid are inherited by the Card component and all the child components. To avoid it I need to use additional styles, literally reset text-align property by using :
<Card style={{textAlign: 'initial'}}>

And then it gets back to normal :

screen shot 2016-10-08 at 20 57 58

Is there any better way to handle this situation ?

Thanks

Reordering columns

In flexboxgrid.css reordering props like first or last are concerned to use with Cols. Here it can be used only with rows.

Row.propTypes = {
  reverse: PropTypes.bool,
  start: ModificatorType,
  center: ModificatorType,
  end: ModificatorType,
  top: ModificatorType,
  middle: ModificatorType,
  bottom: ModificatorType,
  around: ModificatorType,
  between: ModificatorType,
  first: ModificatorType,
  last: ModificatorType,
  className: PropTypes.string,
  tagName: PropTypes.string,
  children: PropTypes.node
};

In this case I can't do something like that:

<div class="row">
    <div class="col-xs-2">
        <div class="box">
            1
        </div>
    </div>
    <div class="col-xs-2">
        <div class="box">
            2
        </div>
    </div>
    <div class="col-xs-2 first-xs">
        <div class="box">
            3
        </div>
    </div>
</div>

What is the exact loaders setup we need to have?

I don't want to load all dependencies with CSS modules enabled, just this one. It would be great to include in the docs the exact required webpack loader setup. I tried this:

    {
        test: /\.s?css$/,
        loaders: ['style', 'css?modules', 'sass'],
        include: [
          resolve(__dirname, '../node_modules/flexboxgrid'),
          resolve(__dirname, '../node_modules/react-flexbox-grid'),
        ],
      },

but got this error:

ERROR in ./~/react-flexbox-grid/~/css-loader?modules&importLoaders=1!./~/react-flexbox-grid/~/sass-loader!./~/react-flexbox-grid/~/style-loader!./~/react-flexbox-grid/~/css-loader!./~/react-flexbox-grid/~/sass-loader!./~/react-flexbox-grid/lib/style.scss
Module build failed: Invalid CSS after "...load the styles": expected 1 selector or at-r ule, was "content = requi..."
 @ ./~/react-flexbox-grid/lib/style.scss 4:14-257 13:2-17:4 14:20-263

What am I doing wrong?

What about nested grids?

Nest grids inside grids inside grids.

How to achieve nested grids, I'm writing some complex grids which need this but it seems isn't able to do it.

Thank you!

Error finding ~flexboxgrid

I'm relatively new to Webpack and have a hunch that my problem is in my webpack config. I know you're not Webpack support, but hoping you can point me in the right direction.

Here's the error:

ERROR in ./~/css-loader?sourceMap&modules&localIdentName=[name]_[local]_[hash:base64:3]!./~/postcss-loader!./~/react-flexbox-grid/lib/style.scss
    Module build failed: Error: /Users/ryan/code/test/web/node_modules/react-flexbox-grid/lib/style.scss:1:1: Failed to find '~flexboxgrid' from /Users/ryan/code/test/web

The referenced /Users/ryan/code/test/web/node_modules/react-flexbox-grid/lib/style.scss has this:

@import '~flexboxgrid';

My webpack.config has this:

        test: /\.scss$/,
        loaders: [
          'isomorphic-style-loader',
          `css-loader?${DEBUG ? 'sourceMap&' : 'minimize&'}modules&localIdentName=` +
          `${DEBUG ? '[name]_[local]_[hash:base64:3]' : '[hash:base64:4]'}`,
          'postcss-loader',
        ],

Any help would be massively appreciated!

Getting set up with react-flexbox-grid

I'm new to webpack, and I'm not entirely sure how to convert my project over to use react-flexbox-grid. I added in the dependencies listed on the git repo (classnames, flexboxgrid, and react-flexbox-grid), as well as some other dependencies that were in the example (autoprefixer, extract-text-webpack-plugin, and babel-polyfill) that I don't know if I need. I'm trying to make my Editor window use the react-flexbox-grid layout; here are the files below:

Editor.js

import React from 'react';
import Paper from 'material-ui/Paper';
import {Grid} from 'react-flexbox-grid/lib/components/Grid';

// need to change this so that it is responsive to the size of the window
const style = {
  minHeight: 1000,
  width: '100%',
  minWidth: 400,
  marginTop: 500,
  margin: 0,
  borderRadius: 0,
  textAlign: 'center',
  display: 'inline-block',
  border: '1px solid black',
};

const verticalCenter = {
  margin: 'auto',
  border: '1px solid blue',
  width: '50%',
  position: 'absolute',
}

var Editor = React.createClass({

  render: function() {
    return (
      <div style={verticalCenter}>
        <Paper style={style} zDepth={1}>
          {this.props.children}
        </Paper>
      </div>
    )
  }
});

module.exports = Editor;

package.json

{
  "name": "traveltile_2",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "production": "webpack -p",
    "start": "webpack-dev-server"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "autoprefixer": "^6.4.0",
    "babel-polyfill": "^6.13.0",
    "classnames": "^2.2.5",
    "extract-text-webpack-plugin": "^1.0.1",
    "flexboxgrid": "^6.3.0",
    "material-ui": "^0.15.3",
    "react": "^15.3.0",
    "react-dom": "^15.3.0",
    "react-flexbox-grid": "^0.10.2",
    "react-gmaps": "^1.5.0",
    "react-router": "^2.6.1",
    "react-tap-event-plugin": "^1.0.0"
  },
  "devDependencies": {
    "babel-core": "^6.13.2",
    "babel-loader": "^6.2.4",
    "babel-preset-es2015": "^6.13.2",
    "babel-preset-react": "^6.11.1",
    "html-webpack-plugin": "^2.22.0",
    "webpack": "^1.13.1",
    "webpack-dev-server": "^1.14.1"
  }
}

webpack.config.js

var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
  template: __dirname + '/app/index.html',
  filename: 'index.html',
  inject: 'body'
});
var autoprefixer = require('autoprefixer');

module.exports = {
  entry: [
    './app/index.js'
  ],
  output: {
    path: __dirname + '/dist',
    filename: 'index_bundle.js'
  },
  module: {
    loaders: [
      {
        test: /.js$/,
        exclude: /node_modules/,
        loader: "babel-loader",
        query: {
          presets: ['react', 'es2015']
        }
      },
      {
        test: /.css$/,
        loader: 'style!css?modules',
        include: /flexboxgrid/,
      }
    ]
  },
  postcss: [autoprefixer],
  plugins: [
    HtmlWebpackPluginConfig,

  ]
}

Any help or advice or additional resources or tutorials on react-flexbox-grid or relevant text would be greatly appreciated! Thanks!

Not loading style.scss

Not sure what's going on but trying to use this lib and have npm installed flexboxgrid & react-flexbox-grid.

ERROR in ./~/react-flexbox-grid/lib/components/Grid.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../style in C:\tradefloor\code\fuck2\node_modules\react-flexbox-grid\lib\components
 @ ./~/react-flexbox-grid/lib/components/Grid.js 21:13-32

ERROR in ./~/react-flexbox-grid/lib/components/Row.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../style in C:\tradefloor\code\fuck2\node_modules\react-flexbox-grid\lib\components
 @ ./~/react-flexbox-grid/lib/components/Row.js 21:13-32

ERROR in ./~/react-flexbox-grid/lib/components/Col.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../style in C:\tradefloor\code\fuck2\node_modules\react-flexbox-grid\lib\components
 @ ./~/react-flexbox-grid/lib/components/Col.js 15:13-32

my webpack config has

{
    test: /\.(scss|css)$/,
    loaders: ["style", "css", "sass"]
},

And other stuff like normalize/material-icon's css/images are pulling in fine. any ideas?

className always empty

Always I'm getting class Name empty so the layout doesn't work. any advice?. please ask me for further info is need, because I'm new with React I dont know which info share

captura de pantalla de 2016-02-23 12-01-46

I'm very curious because I have a simple component. I want the text Hello from here appear in the left and the form on right side

let layout = {
  xs: 6,
  sm: 6,
  md: 6,
  lg: 6
}
<Grid fluid>
  <Row>
    <Col {...layout}>
      <p>Hello from here</p>
    </Col>
    <Col {...layout}>
      <Paper>
        <Row>
          <TextField
            hintText='Name'
            floatingLabelText='Name'/>
        </Row>

        <Row>
          <TextField
            hintText='Email'
            floatingLabelText='Email'
            type='email'/>
        </Row>
        <Row>
          <TextField
            hintText='Password'
            floatingLabelText='Password'
            type='password'/>
        </Row>
        <Row>
          <TextField
            hintText='Re Enter Password'
            floatingLabelText='Re Enter Password'
            type='password'/>
        </Row>
        <Row>
          <a href='#'>Already have an account? Sign in</a>
        </Row>
        <Row>
          <RaisedButton label='Submit' primary/>
        </Row>
      </Paper>
    </Col>
  </Row>
</Grid>

SyntaxError when importing flexboxgrid.css

Hey guys, first of all I wanted to say thanks for this project. It looks awesome and I'm excited to use it!

But I'm having some trouble with the integration. When I run the local webpack server I'm getting a syntax error on the imported flexboxgrid.css.

/Users/petarbojinov/frostytechnologies/frosty-starter/node_modules/flexboxgrid/dist/flexboxgrid.css:1
(function (exports, require, module, __filename, __dirname) { .container-fluid,
                                                              ^

SyntaxError: Unexpected token .
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Module._extensions..js (module.js:442:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/petarbojinov/frostytechnologies/frosty-starter/node_modules/babel-core/node_modules/babel-register/lib/node.js:134:7)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/Users/petarbojinov/frostytechnologies/frosty-starter/node_modules/react-flexbox-grid/lib/components/Grid.js:13:20)
    at Module._compile (module.js:435:26)
    at Module._extensions..js (module.js:442:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/petarbojinov/frostytechnologies/frosty-starter/node_modules/babel-core/node_modules/babel-register/lib/node.js:134:7)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

Here's my webpack config: https://gist.github.com/pbojinov/e87fb7aaf497faf14057
and I started with this boilerplate project: https://github.com/DominicTobias/universal-react

Also made sure to install classnames & flexboxgrid. And I tried the alternative webpack config options in the readme. Any suggestions would be great, thanks!

asset not found: ./~/flexboxgrid/dist/flexboxgrid.css in 0.9.5

Hi all,

I'm using the boilerplate from erikras and I'm having trouble with the version 0.9.5. It worked well with the 0.9.4.

The error is this one :

[webpack-isomorphic-tools] [error] asset not found: ./~/flexboxgrid/dist/flexboxgrid.css

my webpack config looks like this :

require('babel-polyfill');

// Webpack config for development
var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var assetsPath = path.resolve(__dirname, '../static/dist');
var host = (process.env.HOST || 'localhost');
var port = (+process.env.PORT + 1) || 3001;

// https://github.com/halt-hammerzeit/webpack-isomorphic-tools
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
var webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(require('./webpack-isomorphic-tools'));

var babelrc = fs.readFileSync('./.babelrc');
var babelrcObject = {};

try {
  babelrcObject = JSON.parse(babelrc);
} catch (err) {
  console.error('==>     ERROR: Error parsing your .babelrc.');
  console.error(err);
}


var babelrcObjectDevelopment = babelrcObject.env && babelrcObject.env.development || {};

// merge global and dev-only plugins
var combinedPlugins = babelrcObject.plugins || [];
combinedPlugins = combinedPlugins.concat(babelrcObjectDevelopment.plugins);

var babelLoaderQuery = Object.assign({}, babelrcObjectDevelopment, babelrcObject, {plugins: combinedPlugins});
delete babelLoaderQuery.env;

// Since we use .babelrc for client and server, and we don't want HMR enabled on the server, we have to add
// the babel plugin react-transform-hmr manually here.

// make sure react-transform is enabled
babelLoaderQuery.plugins = babelLoaderQuery.plugins || [];
var reactTransform = null;
for (var i = 0; i < babelLoaderQuery.plugins.length; ++i) {
  var plugin = babelLoaderQuery.plugins[i];
  if (Array.isArray(plugin) && plugin[0] === 'react-transform') {
    reactTransform = plugin;
  }
}

if (!reactTransform) {
  reactTransform = ['react-transform', {transforms: []}];
  babelLoaderQuery.plugins.push(reactTransform);
}

if (!reactTransform[1] || !reactTransform[1].transforms) {
  reactTransform[1] = Object.assign({}, reactTransform[1], {transforms: []});
}

// make sure react-transform-hmr is enabled
reactTransform[1].transforms.push({
  transform: 'react-transform-hmr',
  imports: ['react'],
  locals: ['module']
});

module.exports = {
  devtool: 'inline-source-map',
  context: path.resolve(__dirname, '..'),
  entry: {
    'main': [
      'webpack-hot-middleware/client?path=http://' + host + ':' + port + '/__webpack_hmr',
      'font-awesome-webpack!./src/theme/font-awesome.config.js',
      './src/client.js'
    ]
  },
  output: {
    path: assetsPath,
    filename: '[name]-[hash].js',
    chunkFilename: '[name]-[chunkhash].js',
    publicPath: 'http://' + host + ':' + port + '/dist/'
  },
  module: {
    loaders: [
      { test: /\.js?$/, exclude: /node_modules/, loaders: ['babel?' + JSON.stringify(babelLoaderQuery), /* 'eslint-loader' */]},
      { test: /\.json$/, loader: 'json-loader' },
      { test: /\.less$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!less?outputStyle=expanded&sourceMap' },
      { test: /\.scss$/, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap' },
      { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
      { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
      { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
      { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
      { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" },
      { test: webpackIsomorphicToolsPlugin.regular_expression('images'), loader: 'url-loader?limit=10240' },
      { test: /\.css/, loader: "style!css?modules"}
    ]
  },
  progress: true,
  resolve: {
    modulesDirectories: [
      'src',
      'node_modules'
    ],
    extensions: ['', '.json', '.js', '.jsx', '.scss', '.css']
  },
  plugins: [
    // hot reload
    new webpack.HotModuleReplacementPlugin(),
    new webpack.IgnorePlugin(/webpack-stats\.json$/),
    new webpack.DefinePlugin({
      __CLIENT__: true,
      __SERVER__: false,
      __DEVELOPMENT__: true,
      __DEVTOOLS__: true  // <-------- DISABLE redux-devtools HERE
    }),
    webpackIsomorphicToolsPlugin.development()
  ]
};

Do you have any idea where it could come from ?

How to add custom class to Col/Row/Container

I want to add some additional styles to tag which is Col or Row or Container but it seems there are not opportunity to pass my custom css class to these components. It would be great to add this functionality:

this.myCustomCssClass = 'abc';

<Col xs={6} md={3} customClass={this.myCustomCssClass}>Hello, world!</Col>

Updated Installation Docs Available?

I've been stuck for a couple hours facing these 2 errors a few times each..

Cannot resolve module 'flexboxgrid' 13:19-41
Cannot resolve module 'classnames' 9:18-39

Your 'example' works but Im trying to integrate to an existing project where i'm less inclined to shake the tree for a grid. That said, I really would love to give it a spin!

Its a webpack project working independently and with minimal plugins. I added only the code listed on your README.

Thanks!

Any way for default classes?

Trying to see if its possible to have classes to the grid/row/col components. Trying prevent using className everywhere like so:

class App extends Component {
    render() {
        const { todos, actions, children } = this.props

        return (
            <div className={style.normal}>
                <Grid className={style.grid}>

                    <Row className={style.row}>
                        <Col xs={6} md={3}>
                            Title
                        </Col>
                        <Col xs={6} md={3}>
                            Subtitle
                        </Col>
                    </Row>

                    <Row className={style.row}>
                        <Col xs={12} md={12}>
                            <MainSection todos={todos} actions={actions} />
                            {children}
                        </Col>
                    </Row>

                </Grid>
            </div>
        )
    }
}

In my case, trying to set some global padding/margins/etc...

Make CSS Modules optional

CSS Modules are great except when you don't want to use them. It was a thoughtful consideration to to use it in this project but I'd like to be able to turn it off as well.

Remove classnames dependency

I would love to see the classnames dependency removed. In general, it seems to me to be best practice to try to encapsulate the dependencies for a given project within the project itself and not to force package users to reproduce your development setup and to use the styling tools you've chosen. I love this package and what you've done here and think that the structure is really great, but we take great pains not to include packages and build configuration that don't actually apply to our own code - it adds confusion for new developers and it makes it far more difficult to uninstall single dependencies. Any chance you're planning to or would consider planning to get rid of this dependency?

Add react-flexbox-grid into meteor

Hi, guys!
I have meteor 1.3.2 app with React.
I tried to add react-flexbox-grid.

A. As a meteor package
meteor add jimmiebtlr:react-flexbox-grid

app.jsx:

import RFBG from 'meteor/jimmiebtlr:react-flexbox-grid'
console.log(RFBG);

B. As a npm packages
meteor npm install classnames flexboxgrid react-flexbox-grid
app.jsx:

import RFBG from 'react-flexbox-grid/lib/index';
console.log(RFBG);

console error:

/app/node_modules/flexboxgrid/dist/flexboxgrid.css:1
W20160525-22:39:32.291(3)? (STDERR) (function (exports, require, module, __filename, __dirname) { .container-fluid
W20160525-22:39:32.291(3)? (STDERR) ^
W20160525-22:39:32.296(3)? (STDERR) SyntaxError: Unexpected token .
W20160525-22:39:32.296(3)? (STDERR) at Module._compile (module.js:439:25)
W20160525-22:39:32.296(3)? (STDERR) at Object.Module._extensions..js (module.js:474:10)
W20160525-22:39:32.296(3)? (STDERR) at Module.load (module.js:356:32)
W20160525-22:39:32.297(3)? (STDERR) at Function.Module._load (module.js:312:12)
W20160525-22:39:32.297(3)? (STDERR) at Module.require (module.js:364:17)
W20160525-22:39:32.297(3)? (STDERR) at require (module.js:380:17)
W20160525-22:39:32.297(3)? (STDERR) at Object. (/app/node_modules/react-flexbox-grid/lib/components/Grid.js:13:20)
W20160525-22:39:32.297(3)? (STDERR) at Module._compile (module.js:456:26)
W20160525-22:39:32.297(3)? (STDERR) at Object.Module._extensions..js (module.js:474:10)
W20160525-22:39:32.297(3)? (STDERR) at Module.load (module.js:356:32)

In both cases RFBG - undefined.

What I`he done wrong?

Thanx!

integrate into own web pack project failed

Hi, thanks for your work for contributing this flex system. When i trying to integrate the flex box , added the loaders do as the instructions but still does not work. could you please give me some instruction on how to integrate? thx

Stop offset for larger screen size

Is there a way to offset columns for smaller screen sizes? For example, if I wanted wanted offset columns for sm and xs sizes I could do something like xsOffset={3} but this offset for all screen sizes. I tried adding mdOffset={0} or mdOffset to prevent it from offsetting medium or large screen sizes but it does not work.

Error On install

when i npm install react-flexbox-grid
There is mistake as below 👍
image
How can i deal with it?

Avoid passing unsupported props to underlying DOM elements

After updating to React 15.2, react-flexbox-grid is throwing lots of similar warnings:

Warning: Unknown props `lg`, `lgOffset` on <div> tag. Remove these props from the element

I just checked the current GitHub code and this seems to be fixed. But the changes haven't been published to npm yet...

Unknown props `xs`, `sm` on <div> tag

Context
Hi there, I'm using react-flexbox-grid on a React-Redux project.
Reading this example on how to implement react-flexbox-grid
Following :

<Grid fluid>
    <Row>
      <Box type="row" xs={12} sm={3} md={2} lg={1} />
      <Box type="row" xs={6} sm={6} md={8} lg={10} />
      <Box type="row" xs={6} sm={3} md={2} lg={1} />
    </Row>
    <Row>
      <Box type="row" xs={12} sm={3} md={2} lg={1} />
      <Box type="row" xs={12} sm={9} md={10} lg={11} />
    </Row>
    <Row>
      <Box type="row" xs={10} sm={6} md={8} lg={10} />
      <Box type="row" xs={2} sm={6} md={4} lg={2} />
    </Row>
  </Grid>

Issue
Here's my code

<Grid>
  <Row>
    <Col xs={12} sm={6}>
      <Input label="Met ton prénom !" name="firstname" ref="John" onFocus={() => this.changeState(this.refs.John)} />
      <Input label="Ton nom, plus vite que ça !" name="lastname" ref="Doe" onFocus={() => this.changeState(this.refs.Doe)} />
      <Input label="Et ton âge pour la NSA !" name="age" ref="age" onFocus={() => this.changeState(this.refs.age)} />
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
      </p>
    </Col>
    <Col xs={12} sm={6}>
      <Helper focusedElement={this.state.focusedElement} >
        <HelperContent datas={datas} >
          <p>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ac libero et velit tincidunt dictum at non lacus.<br/>
            Phasellus eget dui non tortor malesuada ultrices vitae quis ex.
          </p>
          <img src="http://placehold.it/250x150" />
          <ul>
            <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ac libero et velit tincidunt dictum at non lacus.</li>
            <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ac libero et velit tincidunt dictum at non lacus.</li>
            <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam ac libero et velit tincidunt dictum at non lacus.</li>
          </ul>
        </HelperContent>
      </Helper>
    </Col>
  </Row>
</Grid>

When using this I get some warnings

warning.js:44Warning: Unknown props `xs`, `sm` on <div> tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop
    in div (created by Col)
    in Col (created by PersonalInformations)
    in div (created by Row)
    in Row (created by PersonalInformations)
    in div (created by PersonalInformations)
    in PersonalInformations (created by Form)
    in div (created by Accordion)
    in div (created by Accordion)
    in Accordion (created by Form)
    in div (created by Form)
    in section (created by PageContainer)
    in div (created by PageContainer)
    in PageContainer (created by Form)

When I remove xs sm all warnings disapear. Does anyone has an Idea on what is going on ?

Can we remove `babel-polyfill` dependency?

Hey guys, I was wondering which parts of the code depend on babel-polyfill?

Very similar to #49 request.
I would very much like not to include babel-polyfill in my project, since I don't need it.

I'm willing to help out, just let me know where are we using something that babel-polyfill covers?

Version 1.0 ideas

Just having some ideas for a possible major release (also checking before to start PR stuffs)

  1. Stateless functions instead of class components (since React 0.14) Read more
  2. A HOC (Higher Order Component) function withGrid like React-router withRouter, an alternative to support/inject grid props instead of nesting.
  3. No peerDependencies required but flexboxgrid and react.
  4. Universal module(ES6, CJS, AMD, window global)

What do you think? More suggestions?
@roylee0704 @silvenon @ankitduseja

Not compatible system? skipping optional dependency?

npm WARN optional Skipping failed optional dependency /browser-sync/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /gulp-nodemon/nodemon/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN optional Skipping failed optional dependency /watchify/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [email protected] requires a peer of kerberos@~0.0 but none was installed.
npm WARN [email protected] requires a peer of flexboxgrid@^6.3.0 but none was installed.
npm WARN [email protected] No license field.

This is the log after doing npm install react-flexbox-grid . Also my babel keeps throwing Cannot find module X in lib/components compile errors. Am I missing something?

Thanks

BUG: Centering does not work

Hi,

I copy/pasted the lines below, but they did not have the desired effect.

<Row>
  <Col xs={12}>
    <Row center="sm">
      <Col xs={2}>
        hei
      </Col>
    </Row>
  </Col>
</Row>

Let me know what information I need to provide to help you help me.
Thanks.

lib not included in distro/not built

With 0.10.1, a straight install doesn't seem to build the lib/ directory (or it is not included). You can fix this by changing into node_modules/react-flexbox-grid, doing an npm install, then npm run compile.

Alignment properties not working on Row component

It seems that the Row component only aligns children if you specify a height on the row.

Here's an example:

<Row middle="xs" style={{height: '100%'}}>
  <Col xs={3} />
  <Col xs={9} />
</Row>

I feel like this should be handled by the library itself. If it is necessary, maybe including a property of fullHeight for the Row component would help.

Any ideas why I have to do this manually?

16 column grid

Would it be possible to change the number of columns to 16?

Support direction switch on breakpoint

It would be nice if there would be a feature to change the flex-direction per breakpoint for rows to column or column-reverse. This would allow for stacking of columns on mobile and change to regular grid on tablet or desktop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.