Skip to content

Commit 829a53c

Browse files
committed
Extra layer info
1 parent e4f32f1 commit 829a53c

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

react-spaces/src/components/stories/00-docs/04-ChangeHistory.stories.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ import { CommonHeader } from "../Utils";
77

88
## Change history
99

10-
### 0.1.23 - 0.1.24
10+
### 0.1.24
1111

12-
- Fixed generation of head styles height and z-index which were missing a semi-colon.
1312
- Fixed NPM readme
13+
- Added CHANGELOG.md
14+
15+
### 0.1.23
16+
17+
- Fixed generation of head styles height and z-index which were missing a semi-colon.
1418

1519
### 0.1.22
1620

react-spaces/src/components/stories/02-components/Layer.stories.mdx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,40 @@ import { CommonHeader, description, PropsTable, Prop } from "../Utils";
1313

1414
## Layer
1515

16-
Groups child spaces and places them all at a certain `zIndex`.
16+
Groups child spaces and places them all at a certain `zIndex`.
17+
18+
Spaces only interact with each other when they are in the same `zIndex`.
19+
20+
Spaces in a higher `zIndex` overlap spaces in a lower `zIndex`.
21+
22+
```tsx
23+
<ViewPort>
24+
<Layer zIndex={2}>
25+
<LeftResizable size={200}>...</LeftResizable>
26+
</Layer>
27+
<Layer zIndex={1}>
28+
<Fill>...</Fill>
29+
</Layer>
30+
</ViewPort>
31+
```
32+
33+
In the example above, the `<Fill />` space size is not affected by the `<LeftResizable />` space because
34+
they have been placed at different levels within the `<ViewPort />`. The `<LeftResizable />` space also
35+
overlaps the `<Fill />` space because it is in a higher layer.
36+
37+
An alternate way of specifying the layer is by specifying a zIndex directly on the spaces:
38+
39+
```tsx
40+
<ViewPort>
41+
<LeftResizable size={200} zIndex={2}>...</LeftResizable>
42+
<Fill zIndex={1}>...</Fill>
43+
</ViewPort>
44+
```
45+
46+
This is preferable when moving spaces between different layers without causing a remount on children
47+
inside the space.
48+
49+
### Positioned spaces in different layers
1750

1851
<Preview>
1952
<Story name="Default">

0 commit comments

Comments
 (0)