masua 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -2
- package/package.json +1 -1
- package/react.tsx +7 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# masua
|
|
6
6
|
|
|
7
|
-
Simple masonry layout library in TypeScript.
|
|
7
|
+
Simple masonry layout library in TypeScript. Initially forked from [minimasonry](https://github.com/Spope/MiniMasonry.js) by Spope.
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
@@ -12,6 +12,16 @@ Simple masonry layout library in TypeScript.
|
|
|
12
12
|
import { grid } from 'masua'
|
|
13
13
|
|
|
14
14
|
grid(document.querySelector('#my-grid'))
|
|
15
|
+
// With configuration options.
|
|
16
|
+
grid(document.querySelector('#my-custom-grid'), {
|
|
17
|
+
gutter: 20,
|
|
18
|
+
baseWidth: 300,
|
|
19
|
+
minify: false,
|
|
20
|
+
surroundingGutter: true,
|
|
21
|
+
ultimateGutter: 10,
|
|
22
|
+
direction: 'rtl',
|
|
23
|
+
wedge: true,
|
|
24
|
+
})
|
|
15
25
|
```
|
|
16
26
|
|
|
17
27
|
## React
|
|
@@ -20,7 +30,7 @@ grid(document.querySelector('#my-grid'))
|
|
|
20
30
|
import { Grid } from 'masua'
|
|
21
31
|
|
|
22
32
|
const MyGrid = () => (
|
|
23
|
-
<Grid>
|
|
33
|
+
<Grid disabled={window.innerWidth < 501}>
|
|
24
34
|
<Box />
|
|
25
35
|
<Box size={3} />
|
|
26
36
|
<Box size={2} />
|
package/package.json
CHANGED
package/react.tsx
CHANGED
|
@@ -19,6 +19,7 @@ const configurationProperties = [
|
|
|
19
19
|
|
|
20
20
|
export function Grid({
|
|
21
21
|
disabled = false,
|
|
22
|
+
children,
|
|
22
23
|
...props
|
|
23
24
|
}: JSX.IntrinsicElements['div'] & Partial<ReactConfiguration>) {
|
|
24
25
|
const gridRef = useRef(null)
|
|
@@ -37,7 +38,11 @@ export function Grid({
|
|
|
37
38
|
useEffect(() => {
|
|
38
39
|
if (disabled) return () => {}
|
|
39
40
|
return grid(gridRef.current, configurationProps).destroy
|
|
40
|
-
}, [])
|
|
41
|
+
}, [children])
|
|
41
42
|
|
|
42
|
-
return
|
|
43
|
+
return (
|
|
44
|
+
<div ref={gridRef} {...props}>
|
|
45
|
+
{children}
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
43
48
|
}
|