UNPKG

9.21 kBMarkdownView Raw
1<p align="middle" ><img src="https://naver.github.io/egjs-grid/images/logo.png" /></p>
2<h2 align="middle">Grid</h2>
3<p align="middle">
4<a href="https://www.npmjs.com/package/@egjs/grid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/grid.svg?style=flat-square&color=007acc&label=version" alt="npm version" /></a>&nbsp;
5<img src="https://img.shields.io/badge/language-typescript-blue.svg?style=flat-square" />&nbsp;
6<a href="https://github.com/naver/egjs-grid/actions" target="_blank"><img alt="Github actions" src="https://img.shields.io/github/workflow/status/naver/egjs-grid/Run%20tests?style=flat-square" /></a>&nbsp;
7<a href="https://coveralls.io/github/naver/egjs-grid?branch=main&style=flat-square" target="_blank"><img alt="Coveralls github" src="https://img.shields.io/coveralls/github/naver/egjs-grid.svg?style=flat-square&label=%E2%9C%85%20coverage" /></a>&nbsp;
8<a href="https://github.com/naver/egjs-grid/blob/main/LICENSE" target="_blank"><img src="https://img.shields.io/static/v1?style=flat-square&label=license&message=MIT&color=08CE5D" /></a>&nbsp;
9<a href="https://github.com/naver/egjs-grid/tree/main/packages/react-grid" target="_blank"><img alt="React" src="https://img.shields.io/static/v1.svg?label=&message=React&style=flat-square&color=61daeb" /></a>&nbsp;
10<a href="https://github.com/naver/egjs-grid/tree/main/packages/ngx-grid" target="_blank"><img alt="Angular" src="https://img.shields.io/static/v1.svg?label=&message=Angular&style=flat-square&color=C82B38" /></a>&nbsp;
11<a href="https://github.com/naver/egjs-grid/tree/main/packages/vue-grid" target="_blank"><img
12 alt="Vue"
13 src="https://img.shields.io/static/v1.svg?label=&message=Vue&style=flat-square&color=3fb984" /></a>&nbsp;
14<a href="https://github.com/naver/egjs-grid/tree/main/packages/svelte-grid" target="_blank"><img alt="Svelte" src="https://img.shields.io/static/v1.svg?label=&message=Svelte&style=flat-square&color=C82B38" /></a>
15</p>
16<p align="middle">A component that can arrange items according to the type of grids.</p>
17<p align="middle">
18 <a href="https://naver.github.io/egjs-grid" target="_blank"><strong>Demo</strong></a> /&nbsp;
19 <a href="https://naver.github.io/egjs-grid/release/latest/doc/" target="_blank"><strong>API</strong></a>
20</p>
21
22
23## Grids
24
25|<img src="https://naver.github.io/egjs-grid/images/MasonryGrid.png" />|<img src="https://naver.github.io/egjs-grid/images/JustifiedGrid.png" />|<img src="https://naver.github.io/egjs-grid/images/FrameGrid.png" />|<img src="https://naver.github.io/egjs-grid/images/PackingGrid.png" />|
26|:---:|:---:|:---:|:---:|
27|[**MasonryGrid**](http://naver.github.io/egjs-grid/storybook/?path=/story/examples-masonrygrid--masonry-grid-template)|[**JustifiedGrid**](http://naver.github.io/egjs-grid/storybook/?path=/story/examples-justifiedgrid--justified-grid-template)|[**FrameGrid**](http://naver.github.io/egjs-grid/storybook/?path=/story/examples-framegrid--frame-grid-template)|[**PackingGrid**](http://naver.github.io/egjs-grid/storybook/?path=/story/examples-packinggrid--packing-grid-template)|
28
29* **MasonryGrid**: The MasonryGrid is a grid that stacks items with the same width as a stack of bricks. Adjust the width of all images to the same size, find the lowest height column, and insert a new item.
30* **JustifiedGrid**: 'justified' is a printing term with the meaning that 'it fits in one row wide'. The JustifiedGrid is a grid that the item is filled up on the basis of a line given a size.
31* **FrameGrid**: 'Frame' is a printing term with the meaning that 'it fits in one row wide'. The FrameGrid is a grid that the item is filled up on the basis of a line given a size.
32* **PackingGrid**: The PackingGrid is a grid that shows the important items bigger without sacrificing the weight of the items. Rows and columns are separated so that items are dynamically placed within the horizontal and vertical space rather than arranged in an orderly fashion.
33
34
35## Documents
36- [Get Started and Demos](https://naver.github.io/egjs-grid/)
37- [API documentation](https://naver.github.io/egjs-grid/release/latest/doc/)
38
39## Download and Installation
40
41Download dist files from repo directly or install it via npm.
42
43```bash
44$ npm install @egjs/grid
45```
46
47```html
48<script src="//naver.github.io/egjs-grid/release/latest/dist/grid.min.js"></script>
49```
50
51## How to use
52```js
53import { MasonryGrid, JustifiedGrid, FrameGrid, PackingGrid } from "@egjs/grid";
54
55
56// Grid.MasonryGrid
57const grid = new MasonryGrid(container, {
58 gap: 5,
59});
60
61grid.renderItems();
62```
63
64
65## Packages
66|Package|Version|Description|
67|:-----:|:-----:|:-----:|
68|[**@egjs/react-grid**](https://github.com/naver/egjs-grid/blob/main/packages/react-grid/README.md)|<a href="https://www.npmjs.com/package/@egjs/react-grid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/react-grid.svg?style=flat-square&color=00d8ff&label=%F0%9F%94%96" alt="version" /></a>|[React](https://reactjs.org/) port of @egjs/grid|
69|[**@egjs/ngx-grid**](https://github.com/naver/egjs-grid/blob/main/packages/ngx-grid/README.md)|<a href="https://www.npmjs.com/package/@egjs/ngx-grid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/ngx-grid.svg?style=flat-square&color=dd0031&label=%F0%9F%94%96" alt="version" /></a>| [Angular](https://angular.io/) port of @egjs/grid|
70|[**@egjs/vue-grid**](https://github.com/naver/egjs-grid/blob/main/packages/vue-grid/README.md)|<a href="https://www.npmjs.com/package/@egjs/vue-grid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/vue-grid.svg?style=flat-square&color=42b883&label=%F0%9F%94%96" alt="version" /></a>| [Vue.js](https://vuejs.org/v2/guide/index.html) port of @egjs/grid|
71|[**@egjs/svelte-grid**](https://github.com/naver/egjs-grid/blob/main/packages/svelte-grid/README.md)|<a href="https://www.npmjs.com/package/@egjs/svelte-grid" target="_blank"><img src="https://img.shields.io/npm/v/@egjs/svelte-grid.svg?style=flat-square&color=ff3d00&label=%F0%9F%94%96" alt="version" /></a>| [Svelte](https://svelte.dev/) port of @egjs/grid|
72
73
74## Supported Browsers
75The following are the supported browsers.
76
77|Internet Explorer|Chrome|Firefox|Safari|iOS|Android|
78|---|---|---|---|---|---|
79|9+|Latest|Latest|Latest|7+|4+(polyfill 2.2+)|
80
81
82
83## How to start developing egjs-grid?
84
85For anyone interested to develop egjs-grid, follow the instructions below.
86
87### Development Environment
88
89#### 1. Clone the repository
90
91Clone the egjs-grid repository and install the dependency modules.
92
93```bash
94# Clone the repository.
95$ git clone https://github.com/naver/egjs-grid.git
96```
97
98#### 2. Install dependencies
99
100```
101# Install the dependency modules.
102$ npm install
103```
104### 3. `npm start`
105
106Run `storybook` for development.
107
108Open [http://localhost:6006](http://localhost:6006) to view it in the browser.
109
110The page will reload if you make edits.\
111You will also see any lint errors in the console.
112
113#### 3. `npm build`
114
115Use npm script to build Grid
116
117```bash
118$ npm run build
119```
120
121Two folders will be created after complete build is completed.
122
123- **dist** folder: Includes the **grid.js** and **grid.min.js** files.
124- **doc** folder: Includes API documentation. The home page for the documentation is **doc/index.html**.
125
126### Linting
127
128To keep the same code style, we adopted [ESLint](http://eslint.org/) to maintain our code quality. The [rules](https://github.com/naver/eslint-config-naver/tree/main/rules) are modified version based on [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript).
129Setup your editor for check or run below command for linting.
130
131```bash
132$ npm run lint
133```
134
135### Test
136
137Once you created a branch and done with development, you must perform a test running with `npm test` command before your push the code to a remote repository.
138
139```bash
140$ npm run test
141```
142Running `npm test` command will start [Mocha](https://mochajs.org/) tests via [Karma-runner](https://karma-runner.github.io/).
143
144
145## Bug Report
146
147If you find a bug, please report to us opening a new [Issues](https://github.com/naver/egjs-grid/issues) on GitHub.
148
149
150## License
151egjs-grid is released under the [MIT license](https://github.com/naver/egjs/blob/master/LICENSE.txt).
152
153```
154Copyright (c) 2021-present NAVER Corp.
155
156Permission is hereby granted, free of charge, to any person obtaining a copy
157of this software and associated documentation files (the "Software"), to deal
158in the Software without restriction, including without limitation the rights
159to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
160copies of the Software, and to permit persons to whom the Software is
161furnished to do so, subject to the following conditions:
162
163The above copyright notice and this permission notice shall be included in
164all copies or substantial portions of the Software.
165
166THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
167IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
169AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
170LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
171OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
172THE SOFTWARE.
173```