npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-ez-bs-grid

v1.0.1

Published

Easy component for creating react grids with Bootstrap

Downloads

5

Readme

react-ez-bs-grid

Easy component for creating react grids with Bootstrap

NPM JavaScript Style Guide

Install

This package requires react-bootstrap to function

if you haven't already installed it:

npm install --save react-bootstrap bootstrap

You must also include a bootsrap style sheet in your application: more info at the react-bootstrap documentation site

{/* The following line can be included in your src/index.js or App.js file*/}

import 'bootstrap/dist/css/bootstrap.min.css';

Finally, you can install react-ez-bs-grid!

npm install --save react-ez-bs-grid

Usage

import React, { Component } from 'react'

import { EZBSG } from 'react-ez-bs-grid'

class Example extends Component {
  render() {
    return <EZBSG model={gridModel} />
  }
}

Model

If you want to start using EZBSG, you'll want to ensure that your JSON model is shaped correctly. By parsing this model, EZBSG translates the JSON directly to a responsive bootstrap grid

the EZBSG component requires a model prop that is shaped like the following JSON:

const exampleModel = {
	rows: [/* array of row models */]
	props: {
		/* Props to be passed to the grid component */
		style: { ... } /* standard react component props are supported */
	}
}

Each row should be shaped like the following JSON:

const exampleRow = {
	columns: [/* array of column models */]
	/* props for the bootstrap row component things like style can be passed here */
	props: { 
		className: 'text-center' 
	}
}

Each column should be shaped like the following JSON:

const exampleColumn= {
	type: 'img' /* string defining the type of component to place inside of the column */
	/* All props for the defined component type should be added here */
	props: { 
		src: 'https://placekitten.com/300/300' 
	}
	colProps: {
		style: { ... } /* props for the bootstrap Col component */
	}
}

The final model should resemble this following:

const model = {
	"rows": [{
		"columns": [{
			"type": "text",
			"colProps": {
				"style": {
					"backgroundColor": "rgba(0, 0, 0, 0.9",
					"color": "white",
					"fontSize": "40px",
					"padding": 15
				},
				"className": "text-center"
			},
			"content": "Image Tiles"
		}]
	}, {
		"props": {
			"className": "text-center"
		},
		"columns": [{
			"type": "image",
			"props": {
				"src": "https://placekitten.com/300/300?image=0",
				"roundedCircle": true
			},
			"colProps": {
				"style": {
					"paddingTop": 10,
					"paddingBottom": 10,
					"backgroundColor": "rgba(0, 0, 0, 0.9594841427236049)"
				}
			}
		}, {
			"type": "image",
			"props": {
				"src": "https://placekitten.com/300/300?image=1",
				"roundedCircle": true
			},
			"colProps": {
				"style": {
					"paddingTop": 10,
					"paddingBottom": 10,
					"backgroundColor": "rgba(0, 0, 0, 0.825284755385659)"
				}
			}
		}, {
			"type": "image",
			"props": {
				"src": "https://placekitten.com/300/300?image=2",
				"roundedCircle": true
			},
			"colProps": {
				"style": {
					"paddingTop": 10,
					"paddingBottom": 10,
					"backgroundColor": "rgba(0, 0, 0, 0.30283335827638463)"
				}
			}
		}]
	}]
}

I know it seems like a lot of nested JSON, but I find it easier to manage once the model generation is automated. ;-)

Supported Column Types

Currently EZBSG supports the following types: |type|props|Description| |--|--|--| | grid |accepts model prop (exactly like the regular grid) | place a grid within a column to group related content responsively |text|content - The text to be displayed in the column| Simple text placed within the column| |image|see Bootstrap Image documentation|creates a bootstrap Image component inside the column| |paragraph|content - the text to place inside of the <p> tag|Creates a <p> tag within the column |h1-h6|content - the text to place inside of the heading tag|Creates a heading tag within the column

Example

There is an example application included in this repo, to run it simply run npm run start-example from the root directory.

Development

The easiest way to make changes to this library is by running the sample application locally.

Step 1: run npm start in the root of the repo Step 2: (In another window) change to the example directory cd example step 3: run npm start in the example directory step 4: Hack

License

MIT © Ukeeyo