0.0.1-alpha.3 • Published 4 years ago
@elfo404/grid v0.0.1-alpha.3
@elfo404/grid
A simple opinionated flex-based grid system
@elfo404/grid is a simple and opinionanted responsive grid system for react based on emotion and flexbox.
It's heavily inspired by flexboxGrid. It doesn't try to solve every possible layout problem, but (hopefully) will solve most of the simple use cases.
Install
npm i @elfo404/gridor
yarn add @elfo404/gridUsage
import { GridConfigProvider, Container, Row, Col } from '@elfo404/grid';
const gridConfig = {
breakpoints: {
xs: 30,
sm: 48,
md: 64,
lg: 75,
},
gutter: '1.5rem',
};
export const App = () => {
return (
<GridConfigProvider value={gridConfig}>
<Container>
<Row>
<Col>I'm a column</Col>
<Col>I'm also a column</Col>
</Row>
</Container>
</GridConfigProvider>
);
};With TypeScript
The Col component accepts every key defined in breakpoints as props.
In order to get the correct types, we leverage module augmentation to augment default types.
// grid.d.ts
import { Breakpoints } from '@elfo404/grid';
declare module `@elfo404/grid` {
interface Breakpoints {
xs: number;
sm: number;
// ...
}
}Note: Be sure to include the file in your
includesection intsconfig.json
0.1.0-alpha.1
4 years ago
0.1.0-alpha.2
4 years ago
0.0.1-alpha.11
5 years ago
0.0.1-alpha.10
5 years ago
0.1.0-alpha.0
4 years ago
0.0.1-alpha.8
5 years ago
0.0.1-alpha.9
5 years ago
0.0.1-alpha.7
5 years ago
0.0.1-alpha.6
5 years ago
0.0.1-alpha.5
5 years ago
0.0.1-alpha.4
5 years ago
0.0.1-alpha.3
5 years ago
0.0.1-alpha.2
5 years ago
0.0.1-alpha.1
5 years ago
0.0.0
5 years ago