Skip to content

Commit 0dc5d4d

Browse files
authored
accept dimensions as percentages (#10)
1 parent 4811d5c commit 0dc5d4d

8 files changed

Lines changed: 4556 additions & 1951 deletions

File tree

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,17 @@ const images = Array.from({ length: 50 }, (_, i) => ({
100100
}));
101101

102102
const App = () => {
103-
return <Grid images={images} mode="auto" width={1800} height={1200} />;
103+
return <Grid images={images} width={1800} height={1200} />;
104+
};
105+
```
106+
107+
The dimensions of the grid can be also specified as percentages.
108+
109+
```js
110+
import { Grid } from "react-visual-grid";
111+
112+
const App = () => {
113+
return <Grid images={images} width="90%" height="80%" />;
104114
};
105115
```
106116

@@ -111,13 +121,13 @@ const App = () => {
111121
| enableResize | Allows the grid to be freely resized | boolean | true |
112122
| gap | Gap in pixels between the images | number | 20 |
113123
| gridLayout | Sets up the layout of the grid. can be `horizontal` or `vertical` | string | `vertical` |
114-
| height | Height of the Grid | number | 600 |
124+
| height | Height of the Grid | number or string | 600 |
115125
| imageSizes | Configures the zoom sizes of the Images | Object | [read more](#image-sizes) |
116126
| images | Collection of Images to be rendered | [ImageProps](#imageprops) | [] |
117127
| mode | Configures the rendering mode. set mode to `manual` to render the columns / rows manually | string | `auto` |
118128
| showProgressBar | Prop to show the progress bar | boolean | true |
119129
| theme | Prop to apply different color scheme for the component | Object | [read more](#theme) |
120-
| width | Width of the Grid | number | 1200 |
130+
| width | Width of the Grid | number or string | 1200 |
121131

122132
## 🍭 Demo 1 (Horizontal) <a name = "horizontal"></a>
123133

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
"@babel/plugin-transform-runtime": "^7.19.6",
6868
"@rollup/plugin-babel": "^6.0.3",
6969
"@rollup/plugin-buble": "^1.0.1",
70-
"@rollup/plugin-commonjs": "^23.0.2",
70+
"@rollup/plugin-commonjs": "^23.0.3",
7171
"@rollup/plugin-eslint": "^9.0.1",
7272
"@rollup/plugin-node-resolve": "^15.0.1",
7373
"@rollup/plugin-strip": "^3.0.1",
@@ -97,6 +97,8 @@
9797
"postcss-modules": "^6.0.0",
9898
"postcss-preset-env": "^7.8.3",
9999
"postcss-scss": "^4.0.6",
100+
"react": "^18.2.0",
101+
"react-dom": "^18.2.0",
100102
"rollup": "^3.5.0",
101103
"rollup-plugin-analyzer": "^4.0.0",
102104
"rollup-plugin-copy": "^3.4.0",

0 commit comments

Comments
 (0)