bear-react-grid
TypeScript icon, indicating that this package has built-in type declarations

5.0.13 • Public • Published

Bear React Grid

Bear React Grid Logo

CSS IN JS following Bootstrap RWD design, composed of React + Styled Component

NPM npm downloads npm npm

Documentation

Features

  • Use React + Styled-component and styled-component themeProvider
  • Easier to use
  • Refer to the design of Bootstrap 5 and change it to CSS IN JS method
  • Provides tool CSS for Bootstrap 5 layout
  • Provide RWD Media query method
  • Support NextJS 13 (v5.0.3+)

Installation

yarn add bear-react-grid

in your packages. (Make the version of styled-component you use match the version of styled-component used in bear-react-gird)

"resolutions": {
   "styled-components": "5.3.9"
}

in your App.js add
see the example/src/App.js

import {GridThemeProvider, IGridSetting} from 'bear-react-grid';
import 'bear-react-grid/dist/index.css';


const gridTheme: IGridSetting = {
    spacer: '1rem',
    gutter: '.625rem',
    gridColumns: 24,
    gridBreakpoints: {
        xs: 0,
        sm: 576,
        md: 768,
        lg: 992,
        xl: 1200,
        xxl: 1540,
    },
    containerMaxWidths: {
        sm: 540,
        md: 720,
        lg: 960,
        xl: 1140,
        xxl: 1141,
    },
}


<GridThemeProvider gridTheme={gridTheme}>
    <App/>
</GridThemeProvider>

Examples

use in your page/component:

import {Container, Row, Col, Grid, Flex, media} from 'bear-react-grid';

const MyPage = () => {
    return (
        <Container>
            <MyTitle>bear-react-grid</MyTitle>
            <Row>
                <Col col>col2 (50%) </Col>
                <Col col>col2 (50%) </Col>
            </Row>
            <Grid columns={2}>
                <div>Grid Col2</div>
                
                <Flex className="flex-column gap-2">
                    <div>Grid Col3</div>
                    <div>Grid Col3</div>
                </Flex>
                
                
            </Grid>
            <Grid columns="repeat(1, 3fr)">
                <GridCol>Grid Col3</GridCol>
                <GridCol colSpan={2}>Grid Col3</GridCol>
            </Grid>
        </Container>
    );
}

// use rwd
const MyTitle = styled.div`
    font-size: 12px;
    ${media.md`
        font-size: 14px;
    `}
`

There is also a codesandbox template that you can fork and play with it:

Edit react-editext-template

Use Nextjs example

Edit react-editext-template

License

MIT © imagine10255

Package Sidebar

Install

npm i bear-react-grid

Weekly Downloads

19

Version

5.0.13

License

MIT

Unpacked Size

84.8 kB

Total Files

29

Last publish

Collaborators

  • imagine10255