0.0.1-security.0 • Published 10 months ago

@swenkerorg/illo-numquam v0.0.1-security.0

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

react-styled-flexboxgrid

npm version Build Status NPM Status js-standard-style

Set of React components that implement flexboxgrid.css but with styled-components/emotion. Furthermore, it allows to customize grid configuration like gutter width...

Highly inspired by the excellent react-flexbox-grid which the API is nearly the same than this module.

Demo

Usage

Installation

npm i -S react-styled-flexboxgrid

react-styled-flexboxgrid depends on 2 peer dependencies:

  • react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0
  • prop-types@^15.0.0-0
  • styled-components@2

You should install them in your project.

Basic

import React from 'react'

import {Grid, Col, Row} from 'react-styled-flexboxgrid'

const App = props =>
  <Grid>
    <Row>
      <Col xs={6} md={3}>Hello, world!</Col>
    </Row>
  </Grid>

Grid

The <Grid> component is optional and can help to wrap children in a fixed/fluid container. Use the configuration container for fixed width value.

Props
  • fluid (Boolean): Create a responsive fixed width container or a full width container, spanning the entire width of your viewport. Default: false

Row

Props
  • reverse (Boolean): Use flex-direction: row-reverse. Default: false
  • start
  • center
  • end
  • top
  • middle
  • bottom
  • around
  • between
  • first
  • last (String(xs|sm|md|lg): Align elements to the start or end of row as well as the top, bottom, or center of a column.

Col

Props
  • reverse (Boolean): Use flex-direction: column-reverse. Default: false
  • xs
  • sm
  • md
  • lg (Boolean|Integer):
    • When true, enable auto sizing column.
    • When false, hide colomn for the breakpoint.
    • When integer value, it specify the column size on the grid. (1 to 12)
  • xsOffset
  • smOffset
  • mdOffset
  • lgOffset (Integer): Offset the column.

Configuration

The grid use same defaults than flexboxgrid.css.

You can customize values using <ThemeProvider> component from styled-components. react-styled-flexboxgrid will looks at the flexboxgrid property in the theme.

import React from 'react'

import {ThemeProvider} from 'styled-components'
import {Grid, Col, Row} from 'react-styled-flexboxgrid'

const theme = {
  flexboxgrid: {
    // Defaults
    gridSize: 12, // columns
    gutterWidth: 1, // rem
    outerMargin: 2, // rem
    mediaQuery: 'only screen',
    container: {
      sm: 46, // rem
      md: 61, // rem
      lg: 76  // rem
    },
    breakpoints: {
      xs: 0,  // em
      sm: 48, // em
      md: 64, // em
      lg: 75  // em
    }
  }
}

const App = props =>
  <ThemeProvider theme={theme}>
    <Grid>
      <Row>
        <Col xs={6} md={3}>Hello, world!</Col>
      </Row>
    </Grid>
  </ThemeProvider>

Use with Emotion

To use react-styled-flexboxgrid with emotion, import from 'react-styled-flexboxgrid/emotion':

import { Grid, Col, Row } from 'react-styled-flexboxgrid/emotion'

Related projects

License

MIT

0.0.1-security

10 months ago

0.0.1-security.0

10 months ago

4.8.96

10 months ago

4.8.95

10 months ago

4.7.95

10 months ago

4.7.94

10 months ago

4.7.93

10 months ago

4.7.92

10 months ago

4.7.91

11 months ago

4.7.90

11 months ago

4.7.89

11 months ago

4.7.88

11 months ago

4.7.87

11 months ago

4.7.86

11 months ago

4.7.85

11 months ago

4.7.84

11 months ago

4.7.83

11 months ago

4.7.82

11 months ago

4.7.81

11 months ago

4.7.80

11 months ago

4.7.79

11 months ago

4.6.79

11 months ago

4.6.78

11 months ago

4.6.77

11 months ago

4.6.76

11 months ago

3.6.76

11 months ago

3.6.75

11 months ago

3.6.74

11 months ago

3.6.73

11 months ago

3.6.72

11 months ago

3.6.71

11 months ago

3.6.70

11 months ago

3.6.69

11 months ago

2.6.69

11 months ago

2.6.68

11 months ago

2.6.67

11 months ago

2.6.66

11 months ago

2.6.65

11 months ago

2.6.64

12 months ago

2.6.63

12 months ago

2.5.63

12 months ago

2.5.62

12 months ago

2.5.61

12 months ago

2.5.60

12 months ago

2.5.59

12 months ago

2.5.58

12 months ago

2.5.57

12 months ago

2.5.56

12 months ago

2.5.55

12 months ago

2.4.55

12 months ago

2.4.54

12 months ago

2.4.53

12 months ago

2.4.52

12 months ago

2.4.51

12 months ago

2.3.51

12 months ago

2.3.50

12 months ago

2.3.49

12 months ago

2.3.48

12 months ago

2.3.47

1 year ago

2.3.46

1 year ago

2.3.45

1 year ago

2.3.44

1 year ago

2.3.43

1 year ago

2.3.42

1 year ago

2.3.41

1 year ago

2.3.40

1 year ago

2.3.39

1 year ago

2.3.38

1 year ago

2.3.37

1 year ago

2.3.36

1 year ago

2.3.35

1 year ago

2.3.34

1 year ago

2.3.33

1 year ago

2.3.32

1 year ago

2.3.31

1 year ago

2.2.31

1 year ago

2.2.30

1 year ago

2.2.29

1 year ago

2.2.28

1 year ago

2.2.27

1 year ago

2.2.26

1 year ago

2.2.25

1 year ago

2.2.24

1 year ago

2.2.23

1 year ago

2.2.22

1 year ago

2.2.21

1 year ago

2.2.20

1 year ago

2.2.19

1 year ago

2.2.18

1 year ago

2.2.17

1 year ago

2.2.16

1 year ago

2.1.16

1 year ago

2.1.15

1 year ago

2.1.14

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.1.11

1 year ago

2.1.10

1 year ago

2.1.9

1 year ago

2.1.8

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

1 year ago