Giter Club home page Giter Club logo

golly's Introduction

Golly ๐Ÿ‘ป

npm version Dependency Status styled with prettier

Powerful flexbox grid system built on top of glamor. If you want even more super powers, pair this library with react-matches to change yer columns when the screen resizes ๐Ÿ”ฅ

near-future goals:

  • generate as little CSS as possible.

  • tests

  • docs/demo site

Install

yarn add golly

npm install golly --save

Example Usage

import { Flex, Grid, Cell } from 'golly'

const GridComponent = () => (
  <Grid size={12} gutter={{ x: 32, y: 16 }}>
    <Cell size={6} alignItems="center" justifyContent="center">
      <Flex>
        Flex all the way down ๐Ÿข
      </Flex>
    </Cell>
    <Cell size={6} alignItems="center" justifyContent="center">
      <Flex>
        Always rely on your flex hammer ๐Ÿ”จ
      </Flex>
    </Cell>
  </Grid>
)

Flex component

This is the base component of the grid system. It renders a flex div by default and provides a convenient API around all of the possible flex styles.

tag: PropTypes.string

The HTML tag to render.

innerRef: PropTypes.func

Get access to the internal ref.

inline: PropTypes.bool

Sets CSS display property to inline-flex

order: PropTypes.number

Sets CSS order property

grow: PropTypes.number

Sets CSS flexGrow property

shrink: PropTypes.number

Sets CSS flexShrink property

basis: PropTypes.string

Sets CSS basis property as well as minWidth to help normalize bugs in IE

direction: PropTypes.oneOf(['row','row-reverse','column','column-reverse'])

Sets CSS flexDirection property

wrap: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])

Sets CSS flexWrap property

justifyContent: PropTypes.oneOf(['center','end','space-around','space-between','space-evenly','start'])

Sets CSS justifyContent property, space-evenly is polyfilled by adding before and after pseudo elements.

align: PropTypes.oneOf(['baseline', 'stretch', 'center', 'end', 'start'])

Sets CSS alignSelf property

alignItems: PropTypes.oneOf(['baseline','stretch','center','end','start'])

Sets CSS alignItems property

alignContent: PropTypes.oneOf(['center','end','space-around','space-between','start','stretch'])

Sets CSS alignContent property

Grid component

Dictates the number of columns and the spacing between those columns. Accepts any props that the Flex component accepts.

size: PropTypes.number

The size of a track. This can either be a row or column depending on what the grid's direction prop is set to.

gutter: gutter: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({x:PropTypes.number, y:PropTypes.number})])

Horizontal and vertical spacing between cells, set each respective axis by passing an object of { x, y }.

Cell component

Use to lay content along the grid. Accepts any props that the Flex component accepts.

size: PropTypes.oneOfType([PropTypes.number, PropTypes.string])

The amount of space on the track a cell will occupy. Defaults to 1.

pull: PropTypes.number

Pull the cell by any number of track sizes.

push: PropTypes.number

Push the cell by any number of track sizes.

order: PropTypes.number

The order of the cell in the grid. Because of the grid implementation and how we set gutters, this will actually move the cell in your tree by ordering the children before rendering.

Running Locally

clone repo

git clone [email protected]:souporserious/golly.git

move into folder

cd ~/golly

install dependencies

yarn

run dev mode

yarn dev

open your browser and visit: http://localhost:8080/

golly's People

Contributors

souporserious avatar

Stargazers

Roman avatar

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.