0.1.1 • Published 3 years ago

grids-styled-components v0.1.1

Weekly downloads
4
License
ISC
Repository
github
Last release
3 years ago

grids-styled-components

Grid system of styled-components with similar naming

Features

  • Container: for wrap component with calculate padding
  • Row: for wrap component using property flex-wrap
  • Column: for wrap component with responsive view
  • Display flex and inline-flex

Installing

note!: before you install grids-styled-components you need to install styled-components first

Using npm:

$ npm install styled-components grids-styled-components

Using npm:

$ yarn add styled-components grids-styled-components

Props API

Container

Type propsExtra Small (xs) <576pxSmall (sm) ≥576pxMedium (md) ≥768pxLarge (lg) ≥992pxX-Large (xl) ≥1200pxXX-Large (xxl) ≥1400px
None100%540px720px960px1140px1320px
sm100%540px720px960px1140px1320px
md100%100%720px960px1140px1320px
lg100%100%100%960px1140px1320px
xl100%100%100%100%1140px1320px
xxl100%100%100%100%100%1320px

Column

xs <576pxsm ≥576pxmd ≥768pxlg ≥992pxxl ≥1200pxxxl ≥1400px
Column max-widthNone (auto)540px720px960px1140px1320px
Type propsNonecol-sm-col-md-col-lg-col-xl-col-xxl-

Example

import { Container, Row, Col } from "grids-styled-components";

<Container>
  <Row>
    <Col type="col-md-6">Hi, my name is</Col>
    <Col type="col-md-6">Novandra Zulfi Ramadhan</Col>
  </Row>
</Container>

You can also add props like classname or style

import { Container, Row, Col } from "grids-styled-components";

<Container>
  <Row>
    <Col type="col-md-6" className="first" style={{backgroundColor: "purple"}}>Hi, my name is</Col>
    <Col type="col-md-6" className="second" style={{backgroundColor: "skyblue"}}>Novandra Zulfi Ramadhan</Col>
  </Row>
</Container>

and You can add styling to the component as you like

import styled from "styled-components";
import { Container, Row, Col } from "grids-styled-components";

const SRow = styled(Row)`
  margin: 20px 0;
  overflow-y: hidden;
`

export default Home = () => {
  <Container>
    <SRow>
      <Col type="col-md-6" className="first" style={{backgroundColor: "purple"}}>Hi, my name is</Col>
      <Col type="col-md-6" className="second" style={{backgroundColor: "skyblue"}}>Novandra Zulfi Ramadhan</Col>
    </SRow>
  </Container>
}

Credits

grids-styled-components is inspired by the bootstrap grid system But implement in javascript using react and styled-components;

Follow Me

FacebookInstagramTwitterLinkedinYoutube
FacebookInstagramTwitterLinkedinYoutube